SbInfoMapper.xml 30 KB

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