SbInfoMapper.xml 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857
  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,is_self,
  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,sb.is_self,
  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,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_sb_position position on sb.position_id = position.id
  188. left join t_sys_user user2 on sb.repair_user = user2.user_id
  189. left join t_sys_user user3 on sb.repair_user_second = user3.user_id
  190. left join t_sys_dept sdDept on sb.save_dept = sdDept.dept_id
  191. where
  192. 1 = 1
  193. <if test="keyword != null and keyword != ''">
  194. and (
  195. sb.name like concat('%',#{keyword},'%')
  196. or
  197. sb.no like concat('%',#{keyword},'%')
  198. )
  199. </if>
  200. <if test="name != null and name!=''">
  201. and sb.name like concat('%',#{name},'%')
  202. </if>
  203. <if test="zbh != null and zbh!=''">
  204. and sb.zbh like concat('%',#{zbh},'%')
  205. </if>
  206. <if test="repairUserName != null and repairUserName!=''">
  207. and user2.real_name like concat('%',#{repairUserName},'%')
  208. </if>
  209. <if test="repairUserSecondName != null and repairUserSecondName!=''">
  210. and user3.real_name like concat('%',#{repairUserSecondName},'%')
  211. </if>
  212. <if test="producerName != null and producerName!=''">
  213. and sb.producer_id like concat('%',#{producerName},'%')
  214. </if>
  215. <if test="producerId != null and producerId!=''">
  216. and sb.producer_id like concat('%',#{producerId},'%')
  217. </if>
  218. <if test="positionId != null and positionId!=''">
  219. and sb.position_id = #{positionId}
  220. </if>
  221. <if test="positionNo != null and positionNo!=''">
  222. and sb.position_no like concat('%',#{positionNo},'%')
  223. </if>
  224. <if test="ppNo != null and ppNo!=''">
  225. and sb.pp_no like concat('%',#{ppNo},'%')
  226. </if>
  227. <if test="likeDeptCode != null and likeDeptCode!=''">
  228. and sdDept.dept_code like concat(#{likeDeptCode},'%')
  229. </if>
  230. <if test="financingNo != null and financingNo!=''">
  231. and sb.financing_no like concat(#{financingNo},'%')
  232. </if>
  233. <if test="positionIds != null">
  234. AND sb.position_id in
  235. <foreach item="item" index="index" collection="positionIds" open="(" close=")" separator=",">
  236. #{item}
  237. </foreach>
  238. </if>
  239. <if test="ids != null">
  240. AND sb.id in
  241. <foreach item="item" index="index" collection="ids" open="(" close=")" separator=",">
  242. #{item}
  243. </foreach>
  244. </if>
  245. <if test="useType != null">
  246. and sb.use_type = #{useType}
  247. </if>
  248. <if test="id != null">
  249. and sb.id = #{id}
  250. </if>
  251. <if test="checkId != null">
  252. and sb.check_id = #{checkId}
  253. </if>
  254. <if test="isChild != null">
  255. and sb.is_child = #{isChild}
  256. </if>
  257. <if test="isMeasure != null">
  258. and sb.is_measure = #{isMeasure}
  259. </if>
  260. <if test="isSelf != null">
  261. and sb.is_self = #{isSelf}
  262. </if>
  263. <if test="measureStatus != null">
  264. and sb.measure_status = #{measureStatus}
  265. </if>
  266. <if test="isShow != null">
  267. and sb.is_show = #{isShow}
  268. </if>
  269. <if test="isFinancing != null">
  270. and sb.is_financing = #{isFinancing}
  271. </if>
  272. <if test="useArea != null">
  273. and sb.use_area = #{useArea}
  274. </if>
  275. <if test="useCompany != null">
  276. and sb.use_company = #{useCompany}
  277. </if>
  278. <if test="useProject != null">
  279. and sb.use_project = #{useProject}
  280. </if>
  281. <if test="baoyangTimes != null">
  282. and sb.baoyang_times = #{baoyangTimes}
  283. </if>
  284. <if test="typeId != null and typeId != ''">
  285. and sb.type_id = #{typeId}
  286. </if>
  287. <if test="parentId != null">
  288. and sb.parent_id = #{parentId}
  289. </if>
  290. <if test="model != null">
  291. and sb.model like concat('%',#{model},'%')
  292. </if>
  293. <if test="cph != null">
  294. and sb.model like concat('%',#{cph},'%')
  295. </if>
  296. <if test="useDept != null">
  297. and sb.use_dept = #{useDept}
  298. </if>
  299. <if test="useGroup != null">
  300. and sb.use_group = #{useGroup}
  301. </if>
  302. <if test="saveDept != null">
  303. and sb.save_dept = #{saveDept}
  304. </if>
  305. <if test="saveUser != null">
  306. and sb.save_user = #{saveUser}
  307. </if>
  308. <if test="checkDateStart != null">
  309. and sb.check_date <![CDATA[ >= ]]> #{checkDateStart}
  310. </if>
  311. <if test="checkDateEnd != null">
  312. and sb.check_date <![CDATA[ <= ]]> #{checkDateEnd}
  313. </if>
  314. <if test="nextCheckDateStart != null">
  315. and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
  316. </if>
  317. <if test="nextCheckDateEnd != null">
  318. and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
  319. </if>
  320. <if test="repairUser != null">
  321. and sb.repair_user = #{repairUser}
  322. </if>
  323. <if test="repairUserSecond != null">
  324. and sb.repair_user_second = #{repairUserSecond}
  325. </if>
  326. <if test="repairUserSearch != null">
  327. and (
  328. sb.repair_user = #{repairUserSearch}
  329. or
  330. sb.repair_user_second = #{repairUserSearch}
  331. )
  332. </if>
  333. <if test="status != null">
  334. and sb.status = #{status}
  335. </if>
  336. <if test="modelId != null">
  337. and sb.model_id = #{modelId}
  338. </if>
  339. <if test="notStatusList != null and notStatusList.size > 0">
  340. AND sb.status not in
  341. <foreach item="item" index="index" collection="notStatusList" open="(" close=")" separator=",">
  342. #{item}
  343. </foreach>
  344. </if>
  345. <if test="statusList != null and statusList.size > 0">
  346. AND sb.status in
  347. <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
  348. #{item}
  349. </foreach>
  350. </if>
  351. <if test="sbIds != null and sbIds.size > 0">
  352. AND sb.id in
  353. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  354. #{item}
  355. </foreach>
  356. </if>
  357. <if test="ascriptionDept != null and ascriptionDept">
  358. <include refid="deptSql"/>
  359. </if>
  360. </select>
  361. <select id="selectVOListStandard" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  362. resultType="com.platform.dao.vo.sb.SbInfoVO">
  363. SELECT
  364. sb.id,
  365. sb.no,
  366. sbType.name as typeName,
  367. sb.NAME,
  368. sb.zbh,
  369. sb.status,
  370. sb.use_type,
  371. sb.type_id,
  372. count( standard.id ) as standardNum
  373. FROM
  374. t_sb_info sb
  375. LEFT JOIN t_check_standard standard ON sb.id = standard.sb_id
  376. left join t_sb_type sbType on sb.type_id = sbType.id
  377. where
  378. 1 = 1
  379. <if test="keyword != null and keyword != ''">
  380. and (
  381. sb.name like concat('%',#{keyword},'%')
  382. or
  383. sb.no like concat('%',#{keyword},'%')
  384. )
  385. </if>
  386. <if test="name != null and name!=''">
  387. and sb.name like concat('%',#{name},'%')
  388. </if>
  389. <if test="zbh != null and zbh!=''">
  390. and sb.zbh like concat('%',#{zbh},'%')
  391. </if>
  392. <if test="useType != null">
  393. and sb.use_type = #{useType}
  394. </if>
  395. <if test="baoyangTimes != null">
  396. and sb.baoyang_times = #{baoyangTimes}
  397. </if>
  398. <if test="id != null">
  399. and sb.id = #{id}
  400. </if>
  401. <if test="checkId != null">
  402. and sb.check_id = #{checkId}
  403. </if>
  404. <if test="isChild != null">
  405. and sb.is_child = #{isChild}
  406. </if>
  407. <if test="isFinancing != null">
  408. and sb.is_financing = #{isFinancing}
  409. </if>
  410. <if test="isShow != null">
  411. and sb.is_show = #{isShow}
  412. </if>
  413. <if test="useArea != null">
  414. and sb.use_area = #{useArea}
  415. </if>
  416. <if test="useCompany != null">
  417. and sb.use_company = #{useCompany}
  418. </if>
  419. <if test="useProject != null">
  420. and sb.use_project = #{useProject}
  421. </if>
  422. <if test="typeId != null">
  423. and sb.type_id = #{typeId}
  424. </if>
  425. <if test="isMeasure != null">
  426. and sb.is_measure = #{isMeasure}
  427. </if>
  428. <if test="isSelf != null">
  429. and sb.is_self = #{isSelf}
  430. </if>
  431. <if test="positionNo != null and positionNo!=''">
  432. and sb.position_no like concat('%',#{positionNo},'%')
  433. </if>
  434. <if test="ppNo != null and ppNo!=''">
  435. and sb.pp_no like concat('%',#{ppNo},'%')
  436. </if>
  437. <if test="measureStatus != null">
  438. and sb.measure_status = #{measureStatus}
  439. </if>
  440. <if test="parentId != null">
  441. and sb.parent_id = #{parentId}
  442. </if>
  443. <if test="model != null">
  444. and sb.model like concat('%',#{model},'%')
  445. </if>
  446. <if test="useDept != null">
  447. and sb.use_dept = #{useDept}
  448. </if>
  449. <if test="useGroup != null">
  450. and sb.use_group = #{useGroup}
  451. </if>
  452. <if test="saveDept != null">
  453. and sb.save_dept = #{saveDept}
  454. </if>
  455. <if test="saveUser != null">
  456. and sb.save_user = #{saveUser}
  457. </if>
  458. <if test="nextCheckDateStart != null">
  459. and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
  460. </if>
  461. <if test="nextCheckDateEnd != null">
  462. and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
  463. </if>
  464. <if test="status != null">
  465. and sb.status = #{status}
  466. </if>
  467. <if test="modelId != null">
  468. and sb.model_id = #{modelId}
  469. </if>
  470. group by sb.id
  471. </select>
  472. <select id="selectScreenDetailVOList"
  473. parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  474. resultType="com.platform.dao.vo.sb.SbInfoScreenDetailVO">
  475. select
  476. sb.id, sb.no, sb.zjm, sb.jbdh, sb.level
  477. from t_sb_info sb
  478. <where>
  479. sb.zjm is not null
  480. and sb.jbdh is not null
  481. and is_show = true
  482. </where>
  483. </select>
  484. <select id="selectPageInfoForWarn" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  485. resultType="com.platform.dao.vo.sb.SbInfoVO">
  486. select sb.*
  487. from t_sb_info sb
  488. where
  489. TIMESTAMPDIFF( DAY, CURDATE( ), sb.next_check_date ) <![CDATA[ <= ]]> sb.seat_number
  490. <if test="keyword != null and keyword != ''">
  491. and (
  492. sb.name like concat('%',#{keyword},'%')
  493. or
  494. sb.no like concat('%',#{keyword},'%')
  495. )
  496. </if>
  497. <if test="name != null and name!=''">
  498. and sb.name like concat('%',#{name},'%')
  499. </if>
  500. <if test="financingNo != null and financingNo!=''">
  501. and sb.financing_no like concat(#{financingNo},'%')
  502. </if>
  503. <if test="positionIds != null">
  504. AND sb.position_id in
  505. <foreach item="item" index="index" collection="positionIds" open="(" close=")" separator=",">
  506. #{item}
  507. </foreach>
  508. </if>
  509. <if test="useTypeList != null">
  510. AND sb.use_type in
  511. <foreach item="item" index="index" collection="useTypeList" open="(" close=")" separator=",">
  512. #{item}
  513. </foreach>
  514. </if>
  515. <if test="useType != null">
  516. and sb.use_type = #{useType}
  517. </if>
  518. <if test="isMeasure != null">
  519. and sb.is_measure = #{isMeasure}
  520. </if>
  521. <if test="isSelf != null">
  522. and sb.is_self = #{isSelf}
  523. </if>
  524. <if test="positionNo != null and positionNo!=''">
  525. and sb.position_no like concat('%',#{positionNo},'%')
  526. </if>
  527. <if test="ppNo != null and ppNo!=''">
  528. and sb.pp_no like concat('%',#{ppNo},'%')
  529. </if>
  530. <if test="measureStatus != null">
  531. and sb.measure_status = #{measureStatus}
  532. </if>
  533. <if test="id != null">
  534. and sb.id = #{id}
  535. </if>
  536. <if test="checkId != null">
  537. and sb.check_id = #{checkId}
  538. </if>
  539. <if test="isChild != null">
  540. and sb.is_child = #{isChild}
  541. </if>
  542. <if test="isFinancing != null">
  543. and sb.is_financing = #{isFinancing}
  544. </if>
  545. <if test="isShow != null">
  546. and sb.is_show = #{isShow}
  547. </if>
  548. <if test="useArea != null">
  549. and sb.use_area = #{useArea}
  550. </if>
  551. <if test="useCompany != null">
  552. and sb.use_company = #{useCompany}
  553. </if>
  554. <if test="useProject != null">
  555. and sb.use_project = #{useProject}
  556. </if>
  557. <if test="typeId != null">
  558. and sb.type_id = #{typeId}
  559. </if>
  560. <if test="model != null">
  561. and sb.model like concat('%',#{model},'%')
  562. </if>
  563. <if test="useDept != null">
  564. and sb.use_dept = #{useDept}
  565. </if>
  566. <if test="useGroup != null">
  567. and sb.use_group = #{useGroup}
  568. </if>
  569. <if test="baoyangTimes != null">
  570. and sb.baoyang_times = #{baoyangTimes}
  571. </if>
  572. <if test="nextCheckDateStart != null">
  573. and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
  574. </if>
  575. <if test="nextCheckDateEnd != null">
  576. and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
  577. </if>
  578. <if test="saveDept != null">
  579. and sb.save_dept = #{saveDept}
  580. </if>
  581. <if test="saveUser != null">
  582. and sb.save_user = #{saveUser}
  583. </if>
  584. <if test="status != null">
  585. and sb.status = #{status}
  586. </if>
  587. <if test="modelId != null">
  588. and sb.model_id = #{modelId}
  589. </if>
  590. <if test="notStatusList != null and notStatusList.size > 0">
  591. AND sb.status not in
  592. <foreach item="item" index="index" collection="notStatusList" open="(" close=")" separator=",">
  593. #{item}
  594. </foreach>
  595. </if>
  596. <if test="statusList != null and statusList.size > 0">
  597. AND sb.status in
  598. <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
  599. #{item}
  600. </foreach>
  601. </if>
  602. <if test="sbIds != null and sbIds.size > 0">
  603. AND sb.id in
  604. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  605. #{item}
  606. </foreach>
  607. </if>
  608. <if test="ascriptionDept != null and ascriptionDept">
  609. <include refid="deptSql"/>
  610. </if>
  611. </select>
  612. <select id="getById" parameterType="java.lang.Object" resultType="com.platform.dao.vo.sb.SbInfoVO">
  613. select
  614. <include refid="Left_Column"/>
  615. from t_sb_info sb
  616. left join t_sb_type sbType on sb.type_id = sbType.id
  617. left join t_sb_position position on sb.position_id = position.id
  618. where sb.id = #{value}
  619. </select>
  620. <select id="getByNo" parameterType="java.lang.Object" resultType="com.platform.dao.vo.sb.SbInfoVO">
  621. select
  622. <include refid="Left_Column"/>
  623. from t_sb_info sb
  624. left join t_sb_type sbType on sb.type_id = sbType.id
  625. left join t_sb_position position on sb.position_id = position.id
  626. where sb.no = #{value}
  627. </select>
  628. <select id="getByIds" parameterType="java.util.List" resultType="com.platform.dao.vo.sb.SbInfoVO">
  629. select
  630. <include refid="Left_Column"/>
  631. from t_sb_info sb
  632. where sb.id in
  633. <foreach item="item" index="index" collection="ids" open="(" close=")" separator=",">
  634. #{item}
  635. </foreach>
  636. </select>
  637. <select id="selectNameById" parameterType="Object" resultType="java.lang.String">
  638. select name
  639. from t_sb_info
  640. where id = #{value}
  641. </select>
  642. <select id="selectNoById" parameterType="Object" resultType="java.lang.String">
  643. select no
  644. from t_sb_info
  645. where id = #{value}
  646. </select>
  647. <update id="updateBatch" parameterType="java.util.List">
  648. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  649. update t_sb_info
  650. <set>
  651. <if test="item.measureStatus != null">
  652. measure_status= #{item.measureStatus}
  653. </if>
  654. </set>
  655. where id = #{item.id}
  656. </foreach>
  657. </update>
  658. <update id="updateBatchQrCode" parameterType="java.util.List">
  659. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  660. update t_sb_info
  661. <set>
  662. qr_code=#{item.qrCode}
  663. </set>
  664. where id = #{item.id}
  665. </foreach>
  666. </update>
  667. <update id="updateBatchChild" parameterType="java.util.List">
  668. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  669. update t_sb_info
  670. <set>
  671. parent_id = #{item.parentId}
  672. </set>
  673. where id = #{item.id}
  674. </foreach>
  675. </update>
  676. <update id="updateBatchValue" parameterType="java.util.List">
  677. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  678. update t_sb_info
  679. <set>
  680. initial_value=#{item.initialValue},
  681. current_value=#{item.currentValue},
  682. cut_value=#{item.cutValue},
  683. month=#{item.month},
  684. rate=#{item.rate},
  685. used_month=#{item.usedMonth}
  686. </set>
  687. where id = #{item.id}
  688. </foreach>
  689. </update>
  690. <update id="updateStatusByIds" parameterType="com.platform.dao.dto.sb.SbInfoDTO">
  691. update t_sb_info
  692. <set>
  693. status=${status}, update_time=#{updateTime,jdbcType=TIMESTAMP}
  694. </set>
  695. where
  696. id in
  697. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  698. #{item}
  699. </foreach>
  700. </update>
  701. <update id="updateTotalById" parameterType="java.util.List">
  702. <foreach collection="sbInfos" item="item" index="index" open="" close="" separator=";">
  703. update t_sb_info
  704. <set>
  705. <if test="item.totalHours != null">
  706. total_hours= total_hours+#{item.totalHours},
  707. </if>
  708. <if test="item.totalMiles != null">
  709. total_miles=total_miles+#{item.totalMiles},
  710. </if>
  711. </set>
  712. where id = #{item.id}
  713. </foreach>
  714. </update>
  715. <update id="updateBySbIds" parameterType="com.platform.dao.dto.sb.SbInfoDTO">
  716. update t_sb_info
  717. <set>
  718. <if test="useArea != null">
  719. use_area = #{useArea},
  720. </if>
  721. <if test="useCompany != null">
  722. use_company = #{useCompany},
  723. </if>
  724. <if test="useCompanyName != null">
  725. use_company_name = #{useCompanyName},
  726. </if>
  727. <if test="useProject != null">
  728. use_project = #{useProject},
  729. </if>
  730. <if test="useProjectName != null">
  731. use_project_name = #{useProjectName},
  732. </if>
  733. <if test="useDept != null">
  734. use_dept = #{useDept},
  735. </if>
  736. <if test="useDeptName != null">
  737. use_dept_name = #{useDeptName},
  738. </if>
  739. <if test="useGroup != null">
  740. use_group = #{useGroup},
  741. </if>
  742. <if test="useGroupName != null">
  743. use_group_name = #{useGroupName},
  744. </if>
  745. <if test="saveDept != null">
  746. save_dept = #{saveDept},
  747. </if>
  748. <if test="saveDeptName != null">
  749. save_dept_name = #{saveDeptName},
  750. </if>
  751. <if test="saveUser != null">
  752. save_user = #{saveUser},
  753. </if>
  754. <if test="status != null">
  755. status = #{status},
  756. </if>
  757. <if test="updateTime != null">
  758. update_time=#{updateTime,jdbcType=TIMESTAMP},
  759. </if>
  760. <if test="updateUserId != null">
  761. update_user_id = #{updateUserId},
  762. </if>
  763. <if test="updateUserName != null">
  764. update_user_name = #{updateUserName},
  765. </if>
  766. <if test="saveUserNull != null and saveUserNull">
  767. save_user = null,
  768. </if>
  769. </set>
  770. where
  771. id in
  772. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  773. #{item}
  774. </foreach>
  775. </update>
  776. <select id="getSbTree" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  777. resultType="com.platform.dao.vo.sb.SbTreeVO">
  778. SELECT info.id,info.name,bom.* FROM
  779. t_sb_info info JOIN t_sb_model_spare_bom bom ON
  780. info.id=bom.`sb_id`
  781. WHERE bom.sb_id=#{id}
  782. </select>
  783. <select id="getSubSb" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  784. resultType="com.platform.dao.vo.sb.SbInfoVO">
  785. select id,name from t_sb_info where parent_id=#{id}
  786. </select>
  787. <select id="selectCountByPosition" parameterType="java.lang.String"
  788. resultType="java.lang.Integer">
  789. select count(info.id)
  790. from t_sb_info info
  791. left join t_sb_position position on info.position_id = position.id
  792. where position.code like concat(#{code},'%')
  793. </select>
  794. <select id="selectCountByPositionGroup" parameterType="java.lang.String"
  795. resultType="java.util.Map">
  796. select position.id, position.name, position.code, position.type, position.parent_id parentId,
  797. count(info.id) as num
  798. from t_sb_position position
  799. left join t_sb_info info on info.position_id=position.id
  800. where position.type in (1, 2) and position.del_flag=0
  801. group By position.id
  802. </select>
  803. <select id="selectCountByStatusGroup" parameterType="java.lang.String"
  804. resultType="java.util.Map">
  805. select info.status, count(info.id) as num
  806. from t_sb_info info, t_sb_position position
  807. where
  808. info.position_id = position.id
  809. and position.code like concat(#{code},'%') and position.del_flag=0
  810. group By info.status
  811. </select>
  812. <select id="selectCountByUseTypeGroup" parameterType="java.lang.String"
  813. resultType="java.util.Map">
  814. select info.use_type useType, count(info.id) as num
  815. from t_sb_info info, t_sb_position position
  816. where
  817. info.position_id = position.id
  818. and position.code like concat(#{code},'%') and position.del_flag=0
  819. group By info.use_type
  820. </select>
  821. <select id="selectCountMap" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  822. resultType="java.util.Map">
  823. select count(*) as num, type_id as typeId from t_sb_info
  824. <if test="useType != null">
  825. where use_type = #{useType}
  826. </if>
  827. GROUP BY type_id
  828. </select>
  829. <update id="updateLongYanForInStore" parameterType="com.platform.dao.dto.sb.SbInfoDTO">
  830. update t_sb_info set status = #{status},position_id = null,positionNo = null,ppNo = null,parentId = null where id = #{id}
  831. </update>
  832. </mapper>