KwfTruckMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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.sckw.fleet.dao.KwfTruckMapper">
  4. <select id="statistics" resultType="com.sckw.fleet.model.vo.KwfTableTopCount" parameterType="java.util.Map" >
  5. SELECT
  6. tr.`auth_status` value, count(0) total
  7. from kwf_truck tr
  8. left join kwf_truck_ent tre on tre.truck_id = tr.id
  9. left join kwf_truck_license trl on trl.truck_id = tr.id and trl.del_flag = 0
  10. left join kwf_transport_license tranl on tranl.truck_id = tr.id and tranl.del_flag = 0
  11. left join kwf_fleet_truck flt on flt.truck_id = tr.id and flt.del_flag = 0
  12. left join kwf_fleet fl on fl.id = flt.fleet_id and fl.del_flag = 0
  13. where tr.del_flag = 0 and tre.del_flag = 0
  14. <if test="entId != null and entId != ''">
  15. and tre.ent_id = #{entId, jdbcType=VARCHAR}
  16. </if>
  17. <if test="truckNo != null and truckNo != ''">
  18. and tr.truck_no = #{truckNo, jdbcType=VARCHAR}
  19. </if>
  20. <if test="type != null and type != ''">
  21. and tr.type = #{type, jdbcType=VARCHAR}
  22. </if>
  23. <if test="energyType != null and energyType != ''">
  24. and tr.energy_type = #{energyType, jdbcType=VARCHAR}
  25. </if>
  26. <if test="useType != null and useType != ''">
  27. and tr.use_type = #{useType, jdbcType=VARCHAR}
  28. </if>
  29. <if test="fleetId != null and fleetId != ''">
  30. and fl.id = #{fleetId, jdbcType=VARCHAR}
  31. </if>
  32. <if test="fleetName != null and fleetName != ''">
  33. and fl.name like concat('%',#{fleetName},'%')
  34. </if>
  35. <if test="status != null and status != ''">
  36. and tr.status = #{status, jdbcType=VARCHAR}
  37. </if>
  38. <if test="startTime != null and startTime != '' " >
  39. and DATE( tr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
  40. </if>
  41. <if test="endTime != null and endTime != '' " >
  42. and DATE( tr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
  43. </if>
  44. <if test="keywords != null and keywords != ''">
  45. and (
  46. tr.truck_no like concat('%',#{keywords},'%')
  47. )
  48. </if>
  49. GROUP BY tr.`auth_status`
  50. </select>
  51. <select id="findPage" resultType="com.sckw.fleet.model.vo.KwfTruckVo" parameterType="java.util.Map" >
  52. SELECT
  53. tr.id, tr.ent_id entId, tr.truck_no truckNo, tr.type, tr.energy_type energyType, tr.use_type useType,
  54. tr.spec, tr.actual_weight actualWeight, tr.gross_weight grossWeight, tr.tare_weight tareWeight,
  55. tr.color, tr.eev, tr.trailer_no trailerNo, tr.total_complete totalComplete, tr.total_take totalTake,
  56. tr.total_weight totalWeight, tr.business_status businessStatus, tr.remark, tr.status, tr.auth_status authStatus,
  57. tr.create_by createBy, tr.create_time createTime, tr.update_by updateBy, tr.update_time updateTime,
  58. trl.owner, trl.vin, trl.reg_time regTime, trl.grant_time grantTime, trl.grant_unit grantUnit,
  59. trl.driving_no drivingNo, tranl.road_tran_no roadTranNo, tranl.firm_name tranFirmName,
  60. tranl.business_license_no businessLicenseNo, fl.`name` fleetName
  61. from kwf_truck tr
  62. left join kwf_truck_ent tre on tre.truck_id = tr.id
  63. left join kwf_truck_license trl on trl.truck_id = tr.id and trl.del_flag = 0
  64. left join kwf_transport_license tranl on tranl.truck_id = tr.id and tranl.del_flag = 0
  65. left join kwf_fleet_truck flt on flt.truck_id = tr.id and flt.del_flag = 0
  66. left join kwf_fleet fl on fl.id = flt.fleet_id and fl.del_flag = 0
  67. where tr.del_flag = 0 and tre.del_flag = 0
  68. <if test="entId != null and entId != ''">
  69. and tre.ent_id = #{entId, jdbcType=VARCHAR}
  70. </if>
  71. <if test="truckNo != null and truckNo != ''">
  72. and tr.truck_no = #{truckNo, jdbcType=VARCHAR}
  73. </if>
  74. <if test="truckType != null and truckType != ''">
  75. and tr.type = #{type, jdbcType=VARCHAR}
  76. </if>
  77. <if test="energyType != null and energyType != ''">
  78. and tr.energy_type = #{energyType, jdbcType=VARCHAR}
  79. </if>
  80. <if test="useType != null and useType != ''">
  81. and tr.use_type = #{useType, jdbcType=VARCHAR}
  82. </if>
  83. <if test="fleetId != null and fleetId != ''">
  84. and fl.id = #{fleetId, jdbcType=VARCHAR}
  85. </if>
  86. <if test="fleetName != null and fleetName != ''">
  87. and fl.name like concat('%',#{fleetName},'%')
  88. </if>
  89. <if test="status != null and status != ''">
  90. and tr.status = #{status, jdbcType=VARCHAR}
  91. </if>
  92. <if test="authStatus != null and status != ''">
  93. and tr.auth_status = #{authStatus, jdbcType=VARCHAR}
  94. </if>
  95. <if test="startTime != null and startTime != '' " >
  96. and DATE( tr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
  97. </if>
  98. <if test="endTime != null and endTime != '' " >
  99. and DATE( tr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
  100. </if>
  101. <choose>
  102. <when test="ids != null">
  103. and tr.id in
  104. <foreach collection="ids" item="id" open="(" close=")" separator=",">
  105. #{id,jdbcType=BIGINT}
  106. </foreach>
  107. </when>
  108. </choose>
  109. <if test="keywords != null and keywords != ''">
  110. and (
  111. tr.truck_no like concat('%',#{keywords},'%')
  112. )
  113. </if>
  114. ORDER BY tr.create_time desc
  115. </select>
  116. <select id="findList" resultType="java.util.Map" parameterType="java.util.Map" >
  117. SELECT
  118. tr.id, tre.ent_id entId, truck_no truckNo, type, energy_type energyType, use_type useType,
  119. spec, actual_weight actualWeight, gross_weight grossWeight, tare_weight tareWeight,
  120. color, eev, trailer_no trailerNo, total_complete totalComplete, total_take totalTake,
  121. total_weight totalWeight, business_status businessStatus, tr.remark, tr.status, tr.auth_status authStatus,
  122. tr.create_by createBy, tr.create_time createTime, tr.update_by updateBy, tr.update_time updateTime
  123. from kwf_truck tr
  124. left join kwf_truck_ent tre on tre.truck_id = tr.id
  125. where tr.del_flag = 0 and tre.del_flag = 0
  126. <if test="entId != null and entId != ''">
  127. and tre.ent_id = #{entId, jdbcType=VARCHAR}
  128. </if>
  129. <if test="truckNo != null and truckNo != ''">
  130. and tr.truck_no like concat('%',#{truckNo},'%')
  131. </if>
  132. <if test="wholeTruckNo != null and wholeTruckNo != ''">
  133. and tr.truck_no = #{wholeTruckNo, jdbcType=VARCHAR}
  134. </if>
  135. <if test="type != null and type != ''">
  136. and tr.type = #{type, jdbcType=VARCHAR}
  137. </if>
  138. <if test="energyType != null and energyType != ''">
  139. and tr.energy_type = #{energyType, jdbcType=VARCHAR}
  140. </if>
  141. <if test="useType != null and useType != ''">
  142. and tr.use_type = #{useType, jdbcType=VARCHAR}
  143. </if>
  144. <if test="status != null and status != ''">
  145. and tr.status = #{status, jdbcType=VARCHAR}
  146. </if>
  147. <if test="authStatus != null and status != ''">
  148. and tr.auth_status = #{authStatus, jdbcType=VARCHAR}
  149. </if>
  150. <if test="startTime != null and startTime != '' " >
  151. and DATE( tr.create_time) <![CDATA[ >= ]]> #{startTime,jdbcType=TIMESTAMP}
  152. </if>
  153. <if test="endTime != null and endTime != '' " >
  154. and DATE( tr.create_time ) <![CDATA[ <= ]]> #{endTime,jdbcType=TIMESTAMP}
  155. </if>
  156. <choose>
  157. <when test="truckNos != null and truckNos != ''">
  158. and tr.truck_no in
  159. <foreach collection="truckNos" item="truckNo" open="(" close=")" separator=",">
  160. #{truckNo,jdbcType=VARCHAR}
  161. </foreach>
  162. </when>
  163. </choose>
  164. <if test="keywords != null and keywords != ''">
  165. and (
  166. tr.truck_no like concat('%',#{keywords},'%')
  167. )
  168. </if>
  169. ORDER BY tr.create_time desc
  170. </select>
  171. <select id="findTruck" resultType="com.sckw.fleet.model.KwfTruck" parameterType="java.util.Map" >
  172. SELECT
  173. id, ent_id entId, truck_no truckNo, type, energy_type energyType, use_type useType,
  174. spec, actual_weight actualWeight, gross_weight grossWeight, tare_weight tareWeight,
  175. color, eev, trailer_no trailerNo, total_complete totalComplete, total_take totalTake,
  176. total_weight totalWeight, business_status businessStatus, remark, status, auth_status authStatus
  177. from kwf_truck tr
  178. where del_flag = 0
  179. <if test="entId != null and entId != ''">
  180. and ent_id = #{entId, jdbcType=VARCHAR}
  181. </if>
  182. <if test="truckNo != null and truckNo != ''">
  183. and truck_no = #{truckNo, jdbcType=VARCHAR}
  184. </if>
  185. <if test="type != null and type != ''">
  186. and type = #{type, jdbcType=VARCHAR}
  187. </if>
  188. <if test="energyType != null and energyType != ''">
  189. and energy_type = #{energyType, jdbcType=VARCHAR}
  190. </if>
  191. <if test="useType != null and useType != ''">
  192. and use_type = #{useType, jdbcType=VARCHAR}
  193. </if>
  194. <if test="status != null and status != ''">
  195. and status = #{status, jdbcType=VARCHAR}
  196. </if>
  197. <if test="authStatus != null and status != ''">
  198. and auth_status = #{authStatus, jdbcType=VARCHAR}
  199. </if>
  200. ORDER BY create_time desc
  201. </select>
  202. <select id="findEntTruck" resultType="com.sckw.fleet.model.KwfTruck" parameterType="com.sckw.fleet.model.KwfTruck" >
  203. SELECT
  204. tr.id, tre.ent_id entId, truck_no truckNo, type, energy_type energyType, use_type useType,
  205. spec, actual_weight actualWeight, gross_weight grossWeight, tare_weight tareWeight,
  206. color, eev, trailer_no trailerNo, total_complete totalComplete, total_take totalTake,
  207. total_weight totalWeight, business_status businessStatus, tr.remark, tr.status,
  208. tr.create_by createBy, tr.create_time createTime, tr.update_by updateBy, tr.update_time updateTime
  209. from kwf_truck tr
  210. left join kwf_truck_ent tre on tre.truck_id = tr.id
  211. where tr.del_flag = 0 and tre.del_flag = 0
  212. and tre.ent_id = #{entId, jdbcType=VARCHAR}
  213. and tr.id = #{id, jdbcType=VARCHAR}
  214. </select>
  215. </mapper>