SbInfoMapper.xml 27 KB

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