SbInfoMapper.xml 28 KB

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