SbInfoMapper.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  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,
  6. financing_no,
  7. sb.financing_no_two,
  8. sb.financing_no_third,
  9. sb.financing_no_four,
  10. sb.financing_no_five,
  11. name, model_id,
  12. is_child,
  13. is_show,
  14. type_id, level, initial_value, current_value, cut_value,
  15. producer_id, source_type, source_sb_id, parent_id, unit, position_id,
  16. use_area,
  17. check_id,
  18. rate,
  19. month,
  20. used_month,
  21. card_no,
  22. use_company,
  23. use_project,
  24. use_dept,
  25. use_group,
  26. use_user,
  27. save_dept,
  28. save_user,
  29. repair_user,
  30. buy_date, start_date, next_check_date, guarantee_date, work_year, retirement_date,
  31. depreciation_type, wb_file, use_file, check_file, sb_image, qr_code, status, remark,
  32. created_user_id, update_user_id, created_time, update_time,
  33. zzh,
  34. fdjxh,
  35. fdjh,
  36. cph,
  37. dph,
  38. zz,
  39. zaiz,
  40. last_repaire_time,
  41. repaire_times,
  42. last_baoyang_time,
  43. last_baoyang_hours,
  44. last_baoyang_miles,
  45. baoyang_times,
  46. rl_type,
  47. color,
  48. use_type,
  49. seat_number,
  50. zjm,
  51. sp_date,
  52. jbdh,
  53. sbdh,
  54. jbd_date,
  55. sbd_date,
  56. bxgs,
  57. sb_date,
  58. check_date,
  59. check_period,
  60. register_no,
  61. character_type,
  62. used_no,
  63. supplier,
  64. repair_user_second,
  65. batch_no,
  66. register_date,
  67. zbh,
  68. refuse_reason,
  69. apply_time,
  70. audit_time,
  71. submit_time,
  72. process_instance_id,
  73. audit_node,
  74. remark,
  75. apply_comment,
  76. scrap_user_id,
  77. scrap_user_name
  78. </sql>
  79. <sql id="Left_Column">
  80. sb.id, sb.no,
  81. sb.financing_no_two,
  82. sb.financing_no_third,
  83. sb.financing_no_four,
  84. sb.financing_no_five,
  85. sb.financing_no,
  86. sb.name, sb.initial_value,
  87. sb.current_value, sb.cut_value,
  88. sb.is_child,
  89. sb.parent_id,
  90. sb.is_show,
  91. sb.unit, sb.position_id,
  92. sb.use_area,
  93. sb.rate,
  94. sb.month,
  95. sb.used_month,
  96. sb.card_no,
  97. sb.check_id,
  98. sb.use_company,
  99. sb.use_project,
  100. sb.use_dept,
  101. sb.use_group,
  102. sb.use_user,
  103. sb.save_dept,
  104. sb.save_user,
  105. sb.repair_user,
  106. sb.buy_date, sb.start_date, sb.next_check_date, sb.guarantee_date, sb.work_year,
  107. sb.retirement_date,
  108. sb.depreciation_type, sb.wb_file, sb.use_file, sb.check_file, sb.sb_image, sb.qr_code, sb.status, sb.remark,
  109. sb.created_user_id, sb.update_user_id, sb.created_time, sb.update_time,
  110. sb.model_id,
  111. sb.zzh,
  112. sb.fdjxh,
  113. sb.fdjh,
  114. sb.cph,
  115. sb.dph,
  116. sb.zz,
  117. sb.zaiz,
  118. sb.last_repaire_time,
  119. sb.repaire_times,
  120. sb.last_baoyang_time,
  121. sb.last_baoyang_hours,
  122. sb.last_baoyang_miles,
  123. sb.use_type,
  124. sb.baoyang_times,
  125. sb.rl_type,
  126. sb.color,
  127. sb.seat_number,
  128. sb.zjm,
  129. sb.sp_date,
  130. sb.jbdh,
  131. sb.sbdh,
  132. sb.total_hours,
  133. sb.total_miles,
  134. sb.jbd_date,
  135. sb.sbd_date,
  136. sb.bxgs,
  137. sb.sb_date,
  138. sb.type_id as typeId,
  139. sb.name_model as nameModel,
  140. sb.model,
  141. sb.producer_id as producerId,
  142. sb.level,
  143. sb.unit,
  144. sb.use_type as useType,
  145. sbType.name as typeName,producer.name as producerName,
  146. position.name as positionName,
  147. sb.check_date,
  148. sb.check_period,
  149. sb.register_no,
  150. sb.character_type,
  151. sb.used_no,
  152. sb.zbh,
  153. sb.supplier,
  154. sb.repair_user_second,
  155. sb.batch_no,
  156. sb.register_date,
  157. sb.refuse_reason,
  158. sb.apply_time,
  159. sb.audit_time,
  160. sb.submit_time,
  161. sb.process_instance_id,
  162. sb.audit_node,
  163. sb.remark,
  164. sb.apply_comment,
  165. sb.scrap_user_id,
  166. sb.scrap_user_name
  167. </sql>
  168. <sql id="deptSql">
  169. <if test="saveDept != null and saveDept != ''">
  170. and sb.save_dept = #{saveDept}
  171. </if>
  172. </sql>
  173. <select id="selectVOList" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  174. resultType="com.platform.dao.vo.sb.SbInfoVO">
  175. select
  176. <include refid="Left_Column"/>
  177. from t_sb_info sb
  178. left join t_sb_type sbType on sb.type_id = sbType.id
  179. left join t_firm_producer producer on sb.producer_id = producer.id
  180. left join t_sb_position position on sb.position_id = position.id
  181. left join t_sys_dept sdDept on sb.save_dept = sdDept.dept_id
  182. where
  183. 1 = 1
  184. <if test="keyword != null and keyword != ''">
  185. and (
  186. sb.name like concat('%',#{keyword},'%')
  187. or
  188. sb.no like concat('%',#{keyword},'%')
  189. )
  190. </if>
  191. <if test="zbh != null and zbh!=''">
  192. and sb.zbh like concat('%',#{zbh},'%')
  193. </if>
  194. <if test="likeDeptCode != null and likeDeptCode!=''">
  195. and sdDept.dept_code like concat(#{likeDeptCode},'%')
  196. </if>
  197. <if test="financingNo != null and financingNo!=''">
  198. and sb.financing_no like concat(#{financingNo},'%')
  199. </if>
  200. <if test="positionIds != null">
  201. AND sb.position_id in
  202. <foreach item="item" index="index" collection="positionIds" open="(" close=")" separator=",">
  203. #{item}
  204. </foreach>
  205. </if>
  206. <if test="useType != null">
  207. and sb.use_type = #{useType}
  208. </if>
  209. <if test="id != null">
  210. and sb.id = #{id}
  211. </if>
  212. <if test="checkId != null">
  213. and sb.check_id = #{checkId}
  214. </if>
  215. <if test="isChild != null">
  216. and sb.is_child = #{isChild}
  217. </if>
  218. <if test="isShow != null">
  219. and sb.is_show = #{isShow}
  220. </if>
  221. <if test="useArea != null">
  222. and sb.use_area = #{useArea}
  223. </if>
  224. <if test="useCompany != null">
  225. and sb.use_company = #{useCompany}
  226. </if>
  227. <if test="useProject != null">
  228. and sb.use_project = #{useProject}
  229. </if>
  230. <if test="typeId != null">
  231. and sb.type_id = #{typeId}
  232. </if>
  233. <if test="parentId != null">
  234. and sb.parent_id = #{parentId}
  235. </if>
  236. <if test="model != null">
  237. and sb.model like concat('%',#{model},'%')
  238. </if>
  239. <if test="useDept != null">
  240. and sb.use_dept = #{useDept}
  241. </if>
  242. <if test="useGroup != null">
  243. and sb.use_group = #{useGroup}
  244. </if>
  245. <if test="saveDept != null">
  246. and sb.save_dept = #{saveDept}
  247. </if>
  248. <if test="saveUser != null">
  249. and sb.save_user = #{saveUser}
  250. </if>
  251. <if test="nextCheckDateStart != null">
  252. and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
  253. </if>
  254. <if test="nextCheckDateEnd != null">
  255. and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
  256. </if>
  257. <if test="status != null">
  258. and sb.status = #{status}
  259. </if>
  260. <if test="modelId != null">
  261. and sb.model_id = #{modelId}
  262. </if>
  263. <if test="notStatusList != null and notStatusList.size > 0">
  264. AND sb.status not in
  265. <foreach item="item" index="index" collection="notStatusList" open="(" close=")" separator=",">
  266. #{item}
  267. </foreach>
  268. </if>
  269. <if test="statusList != null and statusList.size > 0">
  270. AND sb.status in
  271. <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
  272. #{item}
  273. </foreach>
  274. </if>
  275. <if test="sbIds != null and sbIds.size > 0">
  276. AND sb.id in
  277. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  278. #{item}
  279. </foreach>
  280. </if>
  281. <if test="ascriptionDept != null and ascriptionDept">
  282. <include refid="deptSql"/>
  283. </if>
  284. </select>
  285. <select id="selectVOListStandard" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  286. resultType="com.platform.dao.vo.sb.SbInfoVO">
  287. SELECT
  288. sb.id,
  289. sb.no,
  290. sbType.name as typeName,
  291. sb.NAME,
  292. sb.zbh,
  293. sb.status,
  294. sb.use_type,
  295. sb.type_id,
  296. count( standard.id ) as standardNum
  297. FROM
  298. t_sb_info sb
  299. LEFT JOIN t_check_standard standard ON sb.id = standard.sb_id
  300. left join t_sb_type sbType on sb.type_id = sbType.id
  301. where
  302. 1 = 1
  303. <if test="keyword != null and keyword != ''">
  304. and (
  305. sb.name like concat('%',#{keyword},'%')
  306. or
  307. sb.no like concat('%',#{keyword},'%')
  308. )
  309. </if>
  310. <if test="zbh != null and zbh!=''">
  311. and sb.zbh like concat('%',#{zbh},'%')
  312. </if>
  313. <if test="useType != null">
  314. and sb.use_type = #{useType}
  315. </if>
  316. <if test="id != null">
  317. and sb.id = #{id}
  318. </if>
  319. <if test="checkId != null">
  320. and sb.check_id = #{checkId}
  321. </if>
  322. <if test="isChild != null">
  323. and sb.is_child = #{isChild}
  324. </if>
  325. <if test="isShow != null">
  326. and sb.is_show = #{isShow}
  327. </if>
  328. <if test="useArea != null">
  329. and sb.use_area = #{useArea}
  330. </if>
  331. <if test="useCompany != null">
  332. and sb.use_company = #{useCompany}
  333. </if>
  334. <if test="useProject != null">
  335. and sb.use_project = #{useProject}
  336. </if>
  337. <if test="typeId != null">
  338. and sb.type_id = #{typeId}
  339. </if>
  340. <if test="parentId != null">
  341. and sb.parent_id = #{parentId}
  342. </if>
  343. <if test="model != null">
  344. and sb.model like concat('%',#{model},'%')
  345. </if>
  346. <if test="useDept != null">
  347. and sb.use_dept = #{useDept}
  348. </if>
  349. <if test="useGroup != null">
  350. and sb.use_group = #{useGroup}
  351. </if>
  352. <if test="saveDept != null">
  353. and sb.save_dept = #{saveDept}
  354. </if>
  355. <if test="saveUser != null">
  356. and sb.save_user = #{saveUser}
  357. </if>
  358. <if test="nextCheckDateStart != null">
  359. and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
  360. </if>
  361. <if test="nextCheckDateEnd != null">
  362. and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
  363. </if>
  364. <if test="status != null">
  365. and sb.status = #{status}
  366. </if>
  367. <if test="modelId != null">
  368. and sb.model_id = #{modelId}
  369. </if>
  370. group by sb.id
  371. </select>
  372. <select id="selectPageInfoForWarn" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  373. resultType="com.platform.dao.vo.sb.SbInfoVO">
  374. select
  375. <include refid="Left_Column"/>
  376. from t_sb_info sb
  377. left join t_sb_type sbType on sb.type_id = sbType.id
  378. left join t_firm_producer producer on sb.producer_id = producer.id
  379. left join t_sb_position position on sb.position_id = position.id
  380. left join t_sys_dept sdDept on sb.save_dept = sdDept.dept_id
  381. where
  382. TIMESTAMPDIFF( DAY, CURDATE( ), sb.next_check_date ) <![CDATA[ <= ]]> sb.seat_number
  383. <if test="keyword != null and keyword != ''">
  384. and (
  385. sb.name like concat('%',#{keyword},'%')
  386. or
  387. sb.no like concat('%',#{keyword},'%')
  388. )
  389. </if>
  390. <if test="likeDeptCode != null and likeDeptCode!=''">
  391. and sdDept.dept_code like concat(#{likeDeptCode},'%')
  392. </if>
  393. <if test="financingNo != null and financingNo!=''">
  394. and sb.financing_no like concat(#{financingNo},'%')
  395. </if>
  396. <if test="positionIds != null">
  397. AND sb.position_id in
  398. <foreach item="item" index="index" collection="positionIds" open="(" close=")" separator=",">
  399. #{item}
  400. </foreach>
  401. </if>
  402. <if test="useType != null">
  403. and sb.use_type = #{useType}
  404. </if>
  405. <if test="id != null">
  406. and sb.id = #{id}
  407. </if>
  408. <if test="checkId != null">
  409. and sb.check_id = #{checkId}
  410. </if>
  411. <if test="isChild != null">
  412. and sb.is_child = #{isChild}
  413. </if>
  414. <if test="isShow != null">
  415. and sb.is_show = #{isShow}
  416. </if>
  417. <if test="useArea != null">
  418. and sb.use_area = #{useArea}
  419. </if>
  420. <if test="useCompany != null">
  421. and sb.use_company = #{useCompany}
  422. </if>
  423. <if test="useProject != null">
  424. and sb.use_project = #{useProject}
  425. </if>
  426. <if test="typeId != null">
  427. and sb.type_id = #{typeId}
  428. </if>
  429. <if test="model != null">
  430. and sb.model like concat('%',#{model},'%')
  431. </if>
  432. <if test="useDept != null">
  433. and sb.use_dept = #{useDept}
  434. </if>
  435. <if test="useGroup != null">
  436. and sb.use_group = #{useGroup}
  437. </if>
  438. <if test="nextCheckDateStart != null">
  439. and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
  440. </if>
  441. <if test="nextCheckDateEnd != null">
  442. and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
  443. </if>
  444. <if test="saveDept != null">
  445. and sb.save_dept = #{saveDept}
  446. </if>
  447. <if test="saveUser != null">
  448. and sb.save_user = #{saveUser}
  449. </if>
  450. <if test="status != null">
  451. and sb.status = #{status}
  452. </if>
  453. <if test="modelId != null">
  454. and sb.model_id = #{modelId}
  455. </if>
  456. <if test="notStatusList != null and notStatusList.size > 0">
  457. AND sb.status not in
  458. <foreach item="item" index="index" collection="notStatusList" open="(" close=")" separator=",">
  459. #{item}
  460. </foreach>
  461. </if>
  462. <if test="statusList != null and statusList.size > 0">
  463. AND sb.status in
  464. <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
  465. #{item}
  466. </foreach>
  467. </if>
  468. <if test="sbIds != null and sbIds.size > 0">
  469. AND sb.id in
  470. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  471. #{item}
  472. </foreach>
  473. </if>
  474. <if test="ascriptionDept != null and ascriptionDept">
  475. <include refid="deptSql"/>
  476. </if>
  477. </select>
  478. <select id="getById" parameterType="java.lang.Object" resultType="com.platform.dao.vo.sb.SbInfoVO">
  479. select
  480. <include refid="Left_Column"/>
  481. from t_sb_info sb
  482. left join t_sb_type sbType on sb.type_id = sbType.id
  483. left join t_firm_producer producer on sb.producer_id = producer.id
  484. left join t_sb_position position on sb.position_id = position.id
  485. where sb.id = #{value}
  486. </select>
  487. <select id="getByIds" parameterType="java.util.List" resultType="com.platform.dao.vo.sb.SbInfoVO">
  488. select
  489. <include refid="Left_Column"/>
  490. from t_sb_info sb
  491. where sb.id in
  492. <foreach item="item" index="index" collection="ids" open="(" close=")" separator=",">
  493. #{item}
  494. </foreach>
  495. </select>
  496. <select id="selectNameById" parameterType="Object" resultType="java.lang.String">
  497. select name
  498. from t_sb_info
  499. where id = #{value}
  500. </select>
  501. <update id="updateBatch" parameterType="java.util.List">
  502. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  503. update t_sb_info
  504. <set>
  505. last_baoyang_time=#{item.lastBaoyangTimes},
  506. last_baoyang_hours=#{item.lastBaoyangHours},
  507. last_baoyang_miles=#{item.lastBaoyangMiles}
  508. </set>
  509. where id = #{item.id}
  510. </foreach>
  511. </update>
  512. <update id="updateBatchQrCode" parameterType="java.util.List">
  513. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  514. update t_sb_info
  515. <set>
  516. qr_code=#{item.qrCode}
  517. </set>
  518. where id = #{item.id}
  519. </foreach>
  520. </update>
  521. <update id="updateBatchChild" parameterType="java.util.List">
  522. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  523. update t_sb_info
  524. <set>
  525. parent_id = #{item.parentId}
  526. </set>
  527. where id = #{item.id}
  528. </foreach>
  529. </update>
  530. <update id="updateBatchValue" parameterType="java.util.List">
  531. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  532. update t_sb_info
  533. <set>
  534. initial_value=#{item.initialValue},
  535. current_value=#{item.currentValue},
  536. cut_value=#{item.cutValue},
  537. month=#{item.month},
  538. rate=#{item.rate},
  539. used_month=#{item.usedMonth}
  540. </set>
  541. where id = #{item.id}
  542. </foreach>
  543. </update>
  544. <update id="updateStatusByIds" parameterType="com.platform.dao.dto.sb.SbInfoDTO">
  545. update t_sb_info
  546. <set>
  547. status=${status}, update_time=#{updateTime,jdbcType=TIMESTAMP}
  548. </set>
  549. where
  550. id in
  551. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  552. #{item}
  553. </foreach>
  554. </update>
  555. <update id="updateTotalById" parameterType="java.util.List">
  556. <foreach collection="sbInfos" item="item" index="index" open="" close="" separator=";">
  557. update t_sb_info
  558. <set>
  559. <if test="item.totalHours != null">
  560. total_hours= total_hours+#{item.totalHours},
  561. </if>
  562. <if test="item.totalMiles != null">
  563. total_miles=total_miles+#{item.totalMiles},
  564. </if>
  565. </set>
  566. where id = #{item.id}
  567. </foreach>
  568. </update>
  569. <update id="updateBySbIds" parameterType="com.platform.dao.dto.sb.SbInfoDTO">
  570. update t_sb_info
  571. <set>
  572. <if test="useArea != null">
  573. use_area = #{useArea},
  574. </if>
  575. <if test="useCompany != null">
  576. use_company = #{useCompany},
  577. </if>
  578. <if test="useCompanyName != null">
  579. use_company_name = #{useCompanyName},
  580. </if>
  581. <if test="useProject != null">
  582. use_project = #{useProject},
  583. </if>
  584. <if test="useProjectName != null">
  585. use_project_name = #{useProjectName},
  586. </if>
  587. <if test="useDept != null">
  588. use_dept = #{useDept},
  589. </if>
  590. <if test="useDeptName != null">
  591. use_dept_name = #{useDeptName},
  592. </if>
  593. <if test="useGroup != null">
  594. use_group = #{useGroup},
  595. </if>
  596. <if test="useGroupName != null">
  597. use_group_name = #{useGroupName},
  598. </if>
  599. <if test="saveDept != null">
  600. save_dept = #{saveDept},
  601. </if>
  602. <if test="saveDeptName != null">
  603. save_dept_name = #{saveDeptName},
  604. </if>
  605. <if test="saveUser != null">
  606. save_user = #{saveUser},
  607. </if>
  608. <if test="status != null">
  609. status = #{status},
  610. </if>
  611. <if test="updateTime != null">
  612. update_time=#{updateTime,jdbcType=TIMESTAMP},
  613. </if>
  614. <if test="updateUserId != null">
  615. update_user_id = #{updateUserId},
  616. </if>
  617. <if test="updateUserName != null">
  618. update_user_name = #{updateUserName},
  619. </if>
  620. <if test="saveUserNull != null and saveUserNull">
  621. save_user = null,
  622. </if>
  623. </set>
  624. where
  625. id in
  626. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  627. #{item}
  628. </foreach>
  629. </update>
  630. </mapper>