SbInfoMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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.platform.dao.mapper.sb.SbInfoMapper">
  4. <sql id="Base_Column_List">
  5. id, no, financing_no, name, model_id,
  6. is_child,
  7. is_show,
  8. type_id, level, initial_value, current_value, cut_value,
  9. producer_id, source_type, source_sb_id, parent_id, unit, position_id,
  10. use_area,
  11. check_id,
  12. rate,
  13. month,
  14. used_month,
  15. card_no,
  16. use_company,
  17. use_project,
  18. use_dept,
  19. use_group,
  20. use_user,
  21. save_dept,
  22. save_user,
  23. repair_user,
  24. buy_date, start_date, next_check_date, guarantee_date, work_year, retirement_date,
  25. depreciation_type, wb_file, use_file, check_file, sb_image, qr_code, status, remark,
  26. created_user_id, update_user_id, created_time, update_time,
  27. zzh,
  28. fdjxh,
  29. fdjh,
  30. cph,
  31. dph,
  32. zz,
  33. zaiz,
  34. last_repaire_time,
  35. repaire_times,
  36. last_baoyang_time,
  37. last_baoyang_hours,
  38. last_baoyang_miles,
  39. baoyang_times,
  40. rl_type,
  41. color,
  42. use_type,
  43. seat_number,
  44. zjm,
  45. sp_date,
  46. jbdh,
  47. sbdh,
  48. jbd_date,
  49. sbd_date,
  50. bxgs,
  51. sb_date,
  52. check_date,
  53. check_period,
  54. register_no,
  55. character_type,
  56. used_no,
  57. supplier,
  58. repair_user_second,
  59. batch_no,
  60. register_date
  61. </sql>
  62. <sql id="Left_Column">
  63. sb.id, sb.no, sb.financing_no, sb.name, sb.initial_value,
  64. sb.current_value, sb.cut_value,
  65. sb.is_child,
  66. sb.parent_id,
  67. sb.is_show,
  68. sb.unit, sb.position_id,
  69. sb.use_area,
  70. sb.rate,
  71. sb.month,
  72. sb.used_month,
  73. sb.card_no,
  74. sb.check_id,
  75. sb.use_company,
  76. sb.use_project,
  77. sb.use_dept,
  78. sb.use_group,
  79. sb.use_user,
  80. sb.save_dept,
  81. sb.save_user,
  82. sb.repair_user,
  83. sb.buy_date, sb.start_date, sb.next_check_date, sb.guarantee_date, sb.work_year,
  84. sb.retirement_date,
  85. sb.depreciation_type, sb.wb_file, sb.use_file, sb.check_file, sb.sb_image, sb.qr_code, sb.status, sb.remark,
  86. sb.created_user_id, sb.update_user_id, sb.created_time, sb.update_time,
  87. sb.model_id,
  88. sb.zzh,
  89. sb.fdjxh,
  90. sb.fdjh,
  91. sb.cph,
  92. sb.dph,
  93. sb.zz,
  94. sb.zaiz,
  95. sb.last_repaire_time,
  96. sb.repaire_times,
  97. sb.last_baoyang_time,
  98. sb.last_baoyang_hours,
  99. sb.last_baoyang_miles,
  100. sb.use_type,
  101. sb.baoyang_times,
  102. sb.rl_type,
  103. sb.color,
  104. sb.seat_number,
  105. sb.zjm,
  106. sb.sp_date,
  107. sb.jbdh,
  108. sb.sbdh,
  109. sb.total_hours,
  110. sb.total_miles,
  111. sb.jbd_date,
  112. sb.sbd_date,
  113. sb.bxgs,
  114. sb.sb_date,
  115. sb.type_id as typeId,
  116. sb.name_model as nameModel,
  117. sb.model,
  118. sb.producer_id as producerId,
  119. sb.level,
  120. sb.unit,
  121. sb.use_type as useType,
  122. sbType.name as typeName,producer.name as producerName,
  123. position.name as positionName,
  124. check_date,
  125. check_period,
  126. register_no,
  127. character_type,
  128. used_no,
  129. supplier,
  130. repair_user_second,
  131. batch_no,
  132. register_date
  133. </sql>
  134. <sql id="deptSql">
  135. <if test="saveDept != null and saveDept != ''">
  136. and sb.save_dept = #{saveDept}
  137. </if>
  138. </sql>
  139. <select id="selectVOList" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  140. resultType="com.platform.dao.vo.sb.SbInfoVO">
  141. select
  142. <include refid="Left_Column"/>
  143. from t_sb_info sb
  144. left join t_sb_type sbType on sb.type_id = sbType.id
  145. left join t_firm_producer producer on sb.producer_id = producer.id
  146. left join t_sb_position position on sb.position_id = position.id
  147. left join t_sys_dept sdDept on sb.save_dept = sdDept.dept_id
  148. where
  149. 1 = 1
  150. <if test="keyword != null and keyword != ''">
  151. and (
  152. sb.name like concat('%',#{keyword},'%')
  153. or
  154. sb.no like concat('%',#{keyword},'%')
  155. )
  156. </if>
  157. <if test="likeDeptCode != null and likeDeptCode!=''">
  158. and sdDept.dept_code like concat(#{likeDeptCode},'%')
  159. </if>
  160. <if test="positionIds != null">
  161. AND sb.position_id in
  162. <foreach item="item" index="index" collection="positionIds" open="(" close=")" separator=",">
  163. #{item}
  164. </foreach>
  165. </if>
  166. <if test="useType != null">
  167. and sb.use_type = #{useType}
  168. </if>
  169. <if test="id != null">
  170. and sb.id = #{id}
  171. </if>
  172. <if test="checkId != null">
  173. and sb.check_id = #{checkId}
  174. </if>
  175. <if test="isChild != null">
  176. and sb.is_child = #{isChild}
  177. </if>
  178. <if test="isShow != null">
  179. and sb.is_show = #{isShow}
  180. </if>
  181. <if test="useArea != null">
  182. and sb.use_area = #{useArea}
  183. </if>
  184. <if test="useCompany != null">
  185. and sb.use_company = #{useCompany}
  186. </if>
  187. <if test="useProject != null">
  188. and sb.use_project = #{useProject}
  189. </if>
  190. <if test="typeId != null">
  191. and sb.type_id = #{typeId}
  192. </if>
  193. <if test="model != null">
  194. and sb.model like concat('%',#{model},'%')
  195. </if>
  196. <if test="useDept != null">
  197. and sb.use_dept = #{useDept}
  198. </if>
  199. <if test="useGroup != null">
  200. and sb.use_group = #{useGroup}
  201. </if>
  202. <if test="saveDept != null">
  203. and sb.save_dept = #{saveDept}
  204. </if>
  205. <if test="saveUser != null">
  206. and sb.save_user = #{saveUser}
  207. </if>
  208. <if test="status != null">
  209. and sb.status = #{status}
  210. </if>
  211. <if test="modelId != null">
  212. and sb.model_id = #{modelId}
  213. </if>
  214. <if test="notStatusList != null and notStatusList.size > 0">
  215. AND sb.status not in
  216. <foreach item="item" index="index" collection="notStatusList" open="(" close=")" separator=",">
  217. #{item}
  218. </foreach>
  219. </if>
  220. <if test="statusList != null and statusList.size > 0">
  221. AND sb.status in
  222. <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
  223. #{item}
  224. </foreach>
  225. </if>
  226. <if test="sbIds != null and sbIds.size > 0">
  227. AND sb.id in
  228. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  229. #{item}
  230. </foreach>
  231. </if>
  232. <if test="ascriptionDept != null and ascriptionDept">
  233. <include refid="deptSql"/>
  234. </if>
  235. </select>
  236. <select id="getById" parameterType="java.lang.Object" resultType="com.platform.dao.vo.sb.SbInfoVO">
  237. select
  238. <include refid="Left_Column"/>
  239. from t_sb_info sb
  240. left join t_sb_type sbType on sb.type_id = sbType.id
  241. left join t_firm_producer producer on sb.producer_id = producer.id
  242. left join t_sb_position position on sb.position_id = position.id
  243. where sb.id = #{value}
  244. </select>
  245. <select id="getByIds" parameterType="java.util.List" resultType="com.platform.dao.vo.sb.SbInfoVO">
  246. select
  247. <include refid="Left_Column"/>
  248. from t_sb_info sb
  249. where sb.id in
  250. <foreach item="item" index="index" collection="ids" open="(" close=")" separator=",">
  251. #{item}
  252. </foreach>
  253. </select>
  254. <select id="selectNameById" parameterType="Object" resultType="java.lang.String">
  255. select name
  256. from t_sb_info
  257. where id = #{value}
  258. </select>
  259. <update id="updateBatch" parameterType="java.util.List">
  260. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  261. update t_sb_info
  262. <set>
  263. last_baoyang_time=#{item.lastBaoyangTimes},
  264. last_baoyang_hours=#{item.lastBaoyangHours},
  265. last_baoyang_miles=#{item.lastBaoyangMiles}
  266. </set>
  267. where id = #{item.id}
  268. </foreach>
  269. </update>
  270. <update id="updateBatchValue" parameterType="java.util.List">
  271. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  272. update t_sb_info
  273. <set>
  274. initial_value=#{item.initialValue},
  275. current_value=#{item.currentValue},
  276. cut_value=#{item.cutValue},
  277. month=#{item.month},
  278. rate=#{item.rate},
  279. used_month=#{item.usedMonth}
  280. </set>
  281. where id = #{item.id}
  282. </foreach>
  283. </update>
  284. <update id="updateStatusByIds" parameterType="com.platform.dao.dto.sb.SbInfoDTO">
  285. update t_sb_info
  286. <set>
  287. status=${status}, update_time=#{updateTime,jdbcType=TIMESTAMP}
  288. </set>
  289. where
  290. id in
  291. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  292. #{item}
  293. </foreach>
  294. </update>
  295. <update id="updateTotalById" parameterType="java.util.List">
  296. <foreach collection="sbInfos" item="item" index="index" open="" close="" separator=";">
  297. update t_sb_info
  298. <set>
  299. <if test="item.totalHours != null">
  300. total_hours= total_hours+#{item.totalHours},
  301. </if>
  302. <if test="item.totalMiles != null">
  303. total_miles=total_miles+#{item.totalMiles},
  304. </if>
  305. </set>
  306. where id = #{item.id}
  307. </foreach>
  308. </update>
  309. <update id="updateBySbIds" parameterType="com.platform.dao.dto.sb.SbInfoDTO">
  310. update t_sb_info
  311. <set>
  312. <if test="useArea != null">
  313. use_area = #{useArea},
  314. </if>
  315. <if test="useCompany != null">
  316. use_company = #{useCompany},
  317. </if>
  318. <if test="useCompanyName != null">
  319. use_company_name = #{useCompanyName},
  320. </if>
  321. <if test="useProject != null">
  322. use_project = #{useProject},
  323. </if>
  324. <if test="useProjectName != null">
  325. use_project_name = #{useProjectName},
  326. </if>
  327. <if test="useDept != null">
  328. use_dept = #{useDept},
  329. </if>
  330. <if test="useDeptName != null">
  331. use_dept_name = #{useDeptName},
  332. </if>
  333. <if test="useGroup != null">
  334. use_group = #{useGroup},
  335. </if>
  336. <if test="useGroupName != null">
  337. use_group_name = #{useGroupName},
  338. </if>
  339. <if test="saveDept != null">
  340. save_dept = #{saveDept},
  341. </if>
  342. <if test="saveDeptName != null">
  343. save_dept_name = #{saveDeptName},
  344. </if>
  345. <if test="saveUser != null">
  346. save_user = #{saveUser},
  347. </if>
  348. <if test="status != null">
  349. status = #{status},
  350. </if>
  351. <if test="updateTime != null">
  352. update_time=#{updateTime,jdbcType=TIMESTAMP},
  353. </if>
  354. <if test="updateUserId != null">
  355. update_user_id = #{updateUserId},
  356. </if>
  357. <if test="updateUserName != null">
  358. update_user_name = #{updateUserName},
  359. </if>
  360. <if test="saveUserNull != null and saveUserNull">
  361. save_user = null,
  362. </if>
  363. </set>
  364. where
  365. id in
  366. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  367. #{item}
  368. </foreach>
  369. </update>
  370. </mapper>