FuelFillingInfoMapper.xml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.yh.saas.plugin.yiliangyiyun.mapper.FuelFillingInfoMapper">
  4. <!-- 获得长途记录总数 -->
  5. <select id="getCountByCondition" parameterType="Map" resultType="java.lang.Integer">
  6. select
  7. count(1)
  8. from(
  9. SELECT
  10. COUNT(ff.id)
  11. FROM fuel_filling_info ff
  12. left join filling_detail_info fd on ff.id = fd.filling_id and fd.delete_flag = '0'
  13. WHERE
  14. ff.comp_id = #{compId}
  15. and ff.delete_flag = '0'
  16. <if test="searchType != null and searchType != ''">
  17. <!--未完成-->
  18. <if test="searchType == 1">
  19. AND ff.travel_status_flag = '1'
  20. </if>
  21. <!--已完成-->
  22. <if test="searchType == 3">
  23. AND (ff.travel_status_flag = '3' OR ff.travel_status_flag = '5')
  24. </if>
  25. </if>
  26. GROUP BY ff.id
  27. ) t
  28. </select>
  29. <!-- 长途加油记录查询 -->
  30. <select id="getListByCondition" parameterType="Map"
  31. resultType="com.yh.saas.plugin.yiliangyiyun.entity.FuelFillingInfo">
  32. SELECT
  33. ff.id,
  34. ff.comp_id as compId,
  35. ff.common_id as commonId,
  36. ff.driver_name as driverName,
  37. ff.car_no as carNo,
  38. ff.send_warehouse as sendWarehouse,
  39. ff.receive_warehouse as receiveWarehouse,
  40. ff.mileage,
  41. ff.total_mileage as totalMileage,
  42. ff.origin_province as originProvince,
  43. ff.origin_city as originCity,
  44. ff.approve_status as approveStatus,
  45. ff.create_date as createDate,
  46. ff.origin_area as originArea,
  47. ff.origin_longitude as originLongitude,
  48. ff.origin_latitude as originLatitude,
  49. ff.destination_province as destinationProvince,
  50. ff.destination_city as destinationCity,
  51. ff.destination_area as destinationArea,
  52. ff.destination_longitude as destinationLongitude,
  53. ff.destination_latitude as destinationLatitude,
  54. ff.total_cost as totalCost,
  55. ff.status_flag as statusFlag,
  56. ff.status as status,
  57. ff.workflow_id as workflowId,
  58. ff.tfc,
  59. ff.travel_status as travelStatus,
  60. ff.travel_status_flag as travelStatusFlag,
  61. fd.oil_consumption as oilConsumption,
  62. fd.current_oil_price as currentOilPrice,
  63. fd.current_consumption as currentConsumption,
  64. fd.address_url as addressUrl
  65. FROM fuel_filling_info ff
  66. left join filling_detail_info fd on ff.id = fd.filling_id and fd.delete_flag = '0'
  67. WHERE
  68. ff.comp_id = #{compId}
  69. and ff.common_id = #{commonId}
  70. and ff.delete_flag = '0'
  71. <if test="searchType != null and searchType != ''">
  72. <!--未完成-->
  73. <if test="searchType == 1">
  74. AND ff.travel_status_flag = '1'
  75. </if>
  76. <!--已完成-->
  77. <if test="searchType == 3">
  78. AND (ff.travel_status_flag = '3' OR ff.travel_status_flag = '5')
  79. </if>
  80. </if>
  81. GROUP BY ff.id
  82. ORDER BY ff.update_date DESC
  83. <if test="currentPage != null and currentPage != ''">
  84. LIMIT ${startRecord}, ${pageSize}
  85. </if>
  86. </select>
  87. <!-- 获得加油管理列表总数 -->
  88. <select id="getCountByConditionPc" parameterType="Map" resultType="java.lang.Integer">
  89. select
  90. count(1)
  91. from(
  92. SELECT
  93. COUNT(ff.id)
  94. FROM fuel_filling_info ff
  95. left join filling_detail_info fd on ff.id = fd.filling_id and fd.delete_flag = '0'
  96. left join track_detail_info td on ff.id = td.filling_id and td.delete_flag = '0'
  97. left join short_filling_info sf on ff.id = sf.filling_id and sf.delete_flag = '0'
  98. WHERE
  99. ff.comp_id = #{compId}
  100. and ff.delete_flag = '0'
  101. <if test="startDate != null">
  102. AND (DATE_FORMAT(ff.create_date,"%Y%m%d") &gt;=
  103. DATE_FORMAT(#{startDate},"%Y%m%d"))
  104. </if>
  105. <if test="endDate != null">
  106. AND (DATE_FORMAT(ff.create_date,"%Y%m%d") &lt;=
  107. DATE_FORMAT(#{endDate},"%Y%m%d"))
  108. </if>
  109. <if test="searchType != null and searchType != ''">
  110. <if test="searchType == 1">
  111. AND ff.approve_status is not null
  112. </if>
  113. <if test="searchType == 2">
  114. AND ff.status = '已通过'
  115. </if>
  116. <if test="searchType == 3">
  117. AND ff.status = '已驳回' and ff.approve_status is null
  118. </if>
  119. </if>
  120. <if test="searchKeyWord != null and searchKeyWord != ''">
  121. AND (lower(ff.driver_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
  122. OR lower(ff.car_no) like lower(CONCAT('%',#{searchKeyWord},'%'))
  123. OR lower(sf.car_no) like lower(CONCAT('%',#{searchKeyWord},'%'))
  124. OR lower(ff.warehouse_name) like lower(CONCAT('%',#{searchKeyWord},'%')))
  125. </if>
  126. <if test="strokeType != null and strokeType != ''">
  127. AND ff.stroke_type = #{strokeType}
  128. </if>
  129. GROUP BY ff.id
  130. ) t
  131. </select>
  132. <!-- 加油管理列表查询 -->
  133. <select id="getListByConditionPc" parameterType="Map"
  134. resultType="com.yh.saas.plugin.yiliangyiyun.entity.FuelFillingInfo">
  135. SELECT
  136. ff.id,
  137. ff.comp_id as compId,
  138. ff.common_id as commonId,
  139. ff.expense_id as expenseId,
  140. ff.driver_name as driverName,
  141. ff.workflow_id as workflowId,
  142. ff.car_no as carNo,
  143. ff.filling_no as fillingNo,
  144. ff.amount_requested as amountRequested,
  145. ff.warehouse_name as warehouseName,
  146. ff.total_mileage as totalMileage,
  147. ff.origin_province as originProvince,
  148. ff.origin_city as originCity,
  149. ff.approve_status as approveStatus,
  150. ff.create_date as createDate,
  151. ff.origin_area as originArea,
  152. ff.stroke_type as strokeType,
  153. ff.origin_longitude as originLongitude,
  154. ff.origin_latitude as originLatitude,
  155. ff.destination_province as destinationProvince,
  156. ff.destination_city as destinationCity,
  157. ff.destination_area as destinationArea,
  158. ff.destination_longitude as destinationLongitude,
  159. ff.destination_latitude as destinationLatitude,
  160. ff.total_cost as totalCost,
  161. ff.tfc,
  162. ff.remark,
  163. ff.status,
  164. ff.travel_status as travelStatus,
  165. ff.travel_status_flag as travelStatusFlag,
  166. fd.oil_consumption as oilConsumption,
  167. fd.current_oil_price as currentOilPrice,
  168. fd.current_consumption as currentConsumption,
  169. fd.address_url as addressUrl
  170. FROM fuel_filling_info ff
  171. left join filling_detail_info fd on ff.id = fd.filling_id and fd.delete_flag = '0'
  172. left join track_detail_info td on ff.id = td.filling_id and td.delete_flag = '0'
  173. left join short_filling_info sf on ff.id = sf.filling_id and sf.delete_flag = '0'
  174. WHERE
  175. ff.comp_id = #{compId}
  176. and ff.delete_flag = '0'
  177. <if test="startDate != null">
  178. AND (DATE_FORMAT(ff.create_date,"%Y%m%d") &gt;=
  179. DATE_FORMAT(#{startDate},"%Y%m%d"))
  180. </if>
  181. <if test="endDate != null">
  182. AND (DATE_FORMAT(ff.create_date,"%Y%m%d") &lt;=
  183. DATE_FORMAT(#{endDate},"%Y%m%d"))
  184. </if>
  185. <if test="searchType != null and searchType != ''">
  186. <if test="searchType == 1">
  187. AND ff.approve_status is not null
  188. </if>
  189. <if test="searchType == 2">
  190. AND ff.status = '已通过'
  191. </if>
  192. <if test="searchType == 3">
  193. AND ff.status = '已驳回' and ff.approve_status is null
  194. </if>
  195. </if>
  196. <if test="searchKeyWord != null and searchKeyWord != ''">
  197. AND (lower(ff.driver_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
  198. OR lower(ff.car_no) like lower(CONCAT('%',#{searchKeyWord},'%'))
  199. OR lower(sf.car_no) like lower(CONCAT('%',#{searchKeyWord},'%'))
  200. OR lower(ff.warehouse_name) like lower(CONCAT('%',#{searchKeyWord},'%')))
  201. </if>
  202. <if test="strokeType != null and strokeType != ''">
  203. AND ff.stroke_type = #{strokeType}
  204. </if>
  205. GROUP BY ff.id
  206. ORDER BY ff.create_date DESC
  207. <if test="currentPage != null and currentPage != ''">
  208. LIMIT ${startRecord}, ${pageSize}
  209. </if>
  210. </select>
  211. <!-- 获得加油编号列表 -->
  212. <select id="getListByConditionFilling" parameterType="Map"
  213. resultType="com.yh.saas.plugin.yiliangyiyun.entity.FuelFillingInfo">
  214. SELECT filling_no from fuel_filling_info
  215. WHERE comp_id = #{compId}
  216. <if test="date != null and date != ''">
  217. AND (lower(filling_no) like lower(CONCAT('JY',#{date},'%')))
  218. </if>
  219. ORDER BY filling_no DESC
  220. </select>
  221. </mapper>