SbInfoMapper.xml 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153
  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. sb.identify_no,
  176. sb.use_no,
  177. sb.sb_code,
  178. sb.install_unit,
  179. sb.exam_result,
  180. sb.use_position,
  181. sb.sb_register_no,
  182. sb.check_type
  183. </sql>
  184. <sql id="deptSql">
  185. <if test="saveDept != null and saveDept != ''">
  186. and sb.save_dept = #{saveDept}
  187. </if>
  188. </sql>
  189. <select id="selectVOList" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  190. resultType="com.platform.dao.vo.sb.SbInfoVO">
  191. select
  192. <include refid="Left_Column"/>
  193. from t_sb_info sb
  194. left join t_sb_type sbType on sb.type_id = sbType.id
  195. left join t_sb_position position on sb.position_id = position.id
  196. left join t_sys_dept sdDept on sb.save_dept = sdDept.dept_id
  197. where
  198. 1 = 1
  199. <if test="keyword != null and keyword != ''">
  200. and (
  201. sb.name like concat('%',#{keyword},'%')
  202. or sb.no like concat('%',#{keyword},'%')
  203. or sb.position_no like concat('%',#{keyword},'%')
  204. or sb.remark like concat('%',#{keyword},'%')
  205. )
  206. </if>
  207. <if test="name != null and name!=''">
  208. and sb.name like concat('%',#{name},'%')
  209. </if>
  210. <if test="zbh != null and zbh!=''">
  211. and sb.zbh like concat('%',#{zbh},'%')
  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="typeList != null">
  247. AND sb.type_id in
  248. <foreach item="item" index="index" collection="typeList" open="(" close=")" separator=",">
  249. #{item}
  250. </foreach>
  251. </if>
  252. <if test="useType != null">
  253. and sb.use_type = #{useType}
  254. </if>
  255. <if test="id != null">
  256. and sb.id = #{id}
  257. </if>
  258. <if test="checkId != null">
  259. and sb.check_id = #{checkId}
  260. </if>
  261. <if test="isChild != null">
  262. and sb.is_child = #{isChild}
  263. </if>
  264. <if test="isMeasure != null">
  265. and sb.is_measure = #{isMeasure}
  266. </if>
  267. <if test="isSelf != null">
  268. and sb.is_self = #{isSelf}
  269. </if>
  270. <if test="measureStatus != null">
  271. and sb.measure_status = #{measureStatus}
  272. </if>
  273. <if test="isShow != null">
  274. and sb.is_show = #{isShow}
  275. </if>
  276. <if test="isFinancing != null">
  277. and sb.is_financing = #{isFinancing}
  278. </if>
  279. <if test="useArea != null">
  280. and sb.use_area = #{useArea}
  281. </if>
  282. <if test="useCompany != null">
  283. and sb.use_company = #{useCompany}
  284. </if>
  285. <if test="useProject != null">
  286. and sb.use_project = #{useProject}
  287. </if>
  288. <if test="baoyangTimes != null">
  289. and sb.baoyang_times = #{baoyangTimes}
  290. </if>
  291. <if test="typeId != null and typeId != ''">
  292. and sb.type_id = #{typeId}
  293. </if>
  294. <if test="parentId != null">
  295. and sb.parent_id = #{parentId}
  296. </if>
  297. <if test="model != null">
  298. and sb.model like concat('%',#{model},'%')
  299. </if>
  300. <if test="cph != null">
  301. and sb.model like concat('%',#{cph},'%')
  302. </if>
  303. <if test="useDept != null">
  304. and sb.use_dept = #{useDept}
  305. </if>
  306. <if test="useGroup != null">
  307. and sb.use_group = #{useGroup}
  308. </if>
  309. <if test="saveDept != null">
  310. and sb.save_dept = #{saveDept}
  311. </if>
  312. <if test="saveUser != null">
  313. and sb.save_user = #{saveUser}
  314. </if>
  315. <if test="checkDateStart != null">
  316. and sb.check_date <![CDATA[ >= ]]> #{checkDateStart}
  317. </if>
  318. <if test="checkDateEnd != null">
  319. and sb.check_date <![CDATA[ <= ]]> #{checkDateEnd}
  320. </if>
  321. <if test="nextCheckDateStart != null">
  322. and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
  323. </if>
  324. <if test="nextCheckDateEnd != null">
  325. and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
  326. </if>
  327. <if test="repairUser != null">
  328. and sb.repair_user = #{repairUser}
  329. </if>
  330. <if test="repairUserSecond != null">
  331. and sb.repair_user_second = #{repairUserSecond}
  332. </if>
  333. <if test="repairUserSearch != null">
  334. and (
  335. sb.repair_user = #{repairUserSearch}
  336. or
  337. sb.repair_user_second = #{repairUserSearch}
  338. )
  339. </if>
  340. <if test="status != null">
  341. and sb.status = #{status}
  342. </if>
  343. <if test="modelId != null">
  344. and sb.model_id = #{modelId}
  345. </if>
  346. <if test="notStatusList != null and notStatusList.size > 0">
  347. AND sb.status not in
  348. <foreach item="item" index="index" collection="notStatusList" open="(" close=")" separator=",">
  349. #{item}
  350. </foreach>
  351. </if>
  352. <if test="statusList != null and statusList.size > 0">
  353. AND sb.status in
  354. <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
  355. #{item}
  356. </foreach>
  357. </if>
  358. <if test="sbIds != null and sbIds.size > 0">
  359. AND sb.id in
  360. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  361. #{item}
  362. </foreach>
  363. </if>
  364. <if test="checkType!=null">
  365. and sb.check_type = #{checkType}
  366. </if>
  367. <if test="ascriptionDept != null and ascriptionDept">
  368. <include refid="deptSql"/>
  369. </if>
  370. <if test="notSbIds != null and notSbIds.size > 0">
  371. <foreach collection="notSbIds" item="item">
  372. and sb.id !=#{item}
  373. </foreach>
  374. </if>
  375. </select>
  376. <select id="selectVOListStandard" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  377. resultType="com.platform.dao.vo.sb.SbInfoVO">
  378. SELECT
  379. sb.id,
  380. sb.no,
  381. sbType.name as typeName,
  382. sb.NAME,
  383. sb.zbh,
  384. sb.status,
  385. sb.use_type,
  386. sb.type_id,
  387. count( standard.id ) as standardNum,
  388. FROM
  389. t_sb_info sb
  390. LEFT JOIN t_check_standard standard ON sb.id = standard.sb_id
  391. left join t_sb_type sbType on sb.type_id = sbType.id
  392. where
  393. 1 = 1
  394. <if test="keyword != null and keyword != ''">
  395. and (
  396. sb.name like concat('%',#{keyword},'%')
  397. or
  398. sb.no like concat('%',#{keyword},'%')
  399. )
  400. </if>
  401. <if test="name != null and name!=''">
  402. and sb.name like concat('%',#{name},'%')
  403. </if>
  404. <if test="zbh != null and zbh!=''">
  405. and sb.zbh like concat('%',#{zbh},'%')
  406. </if>
  407. <if test="useType != null">
  408. and sb.use_type = #{useType}
  409. </if>
  410. <if test="baoyangTimes != null">
  411. and sb.baoyang_times = #{baoyangTimes}
  412. </if>
  413. <if test="id != null">
  414. and sb.id = #{id}
  415. </if>
  416. <if test="checkId != null">
  417. and sb.check_id = #{checkId}
  418. </if>
  419. <if test="isChild != null">
  420. and sb.is_child = #{isChild}
  421. </if>
  422. <if test="isFinancing != null">
  423. and sb.is_financing = #{isFinancing}
  424. </if>
  425. <if test="isShow != null">
  426. and sb.is_show = #{isShow}
  427. </if>
  428. <if test="useArea != null">
  429. and sb.use_area = #{useArea}
  430. </if>
  431. <if test="useCompany != null">
  432. and sb.use_company = #{useCompany}
  433. </if>
  434. <if test="useProject != null">
  435. and sb.use_project = #{useProject}
  436. </if>
  437. <if test="typeId != null">
  438. and sb.type_id = #{typeId}
  439. </if>
  440. <if test="isMeasure != null">
  441. and sb.is_measure = #{isMeasure}
  442. </if>
  443. <if test="isSelf != null">
  444. and sb.is_self = #{isSelf}
  445. </if>
  446. <if test="positionNo != null and positionNo!=''">
  447. and sb.position_no like concat('%',#{positionNo},'%')
  448. </if>
  449. <if test="ppNo != null and ppNo!=''">
  450. and sb.pp_no like concat('%',#{ppNo},'%')
  451. </if>
  452. <if test="measureStatus != null">
  453. and sb.measure_status = #{measureStatus}
  454. </if>
  455. <if test="parentId != null">
  456. and sb.parent_id = #{parentId}
  457. </if>
  458. <if test="model != null">
  459. and sb.model like concat('%',#{model},'%')
  460. </if>
  461. <if test="useDept != null">
  462. and sb.use_dept = #{useDept}
  463. </if>
  464. <if test="useGroup != null">
  465. and sb.use_group = #{useGroup}
  466. </if>
  467. <if test="saveDept != null">
  468. and sb.save_dept = #{saveDept}
  469. </if>
  470. <if test="saveUser != null">
  471. and sb.save_user = #{saveUser}
  472. </if>
  473. <if test="nextCheckDateStart != null">
  474. and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
  475. </if>
  476. <if test="nextCheckDateEnd != null">
  477. and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
  478. </if>
  479. <if test="status != null">
  480. and sb.status = #{status}
  481. </if>
  482. <if test="modelId != null">
  483. and sb.model_id = #{modelId}
  484. </if>
  485. group by sb.id
  486. </select>
  487. <select id="selectScreenDetailVOList"
  488. parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  489. resultType="com.platform.dao.vo.sb.SbInfoScreenDetailVO">
  490. select
  491. sb.id, sb.no, sb.zjm, sb.jbdh, sb.level
  492. from t_sb_info sb
  493. <where>
  494. sb.zjm is not null
  495. and sb.jbdh is not null
  496. and is_show = true
  497. </where>
  498. </select>
  499. <select id="selectPageInfoForWarn" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  500. resultType="com.platform.dao.vo.sb.SbInfoVO">
  501. select sb.*
  502. from t_sb_info sb
  503. where
  504. TIMESTAMPDIFF( DAY, CURDATE( ), sb.next_check_date ) <![CDATA[ <= ]]> sb.seat_number
  505. <if test="keyword != null and keyword != ''">
  506. and (
  507. sb.name like concat('%',#{keyword},'%')
  508. or
  509. sb.no like concat('%',#{keyword},'%')
  510. )
  511. </if>
  512. <if test="name != null and name!=''">
  513. and sb.name like concat('%',#{name},'%')
  514. </if>
  515. <if test="financingNo != null and financingNo!=''">
  516. and sb.financing_no like concat(#{financingNo},'%')
  517. </if>
  518. <if test="positionIds != null">
  519. AND sb.position_id in
  520. <foreach item="item" index="index" collection="positionIds" open="(" close=")" separator=",">
  521. #{item}
  522. </foreach>
  523. </if>
  524. <if test="useTypeList != null">
  525. AND sb.use_type in
  526. <foreach item="item" index="index" collection="useTypeList" open="(" close=")" separator=",">
  527. #{item}
  528. </foreach>
  529. </if>
  530. <if test="useType != null">
  531. and sb.use_type = #{useType}
  532. </if>
  533. <if test="isMeasure != null">
  534. and sb.is_measure = #{isMeasure}
  535. </if>
  536. <if test="isSelf != null">
  537. and sb.is_self = #{isSelf}
  538. </if>
  539. <if test="positionNo != null and positionNo!=''">
  540. and sb.position_no like concat('%',#{positionNo},'%')
  541. </if>
  542. <if test="ppNo != null and ppNo!=''">
  543. and sb.pp_no like concat('%',#{ppNo},'%')
  544. </if>
  545. <if test="measureStatus != null">
  546. and sb.measure_status = #{measureStatus}
  547. </if>
  548. <if test="id != null">
  549. and sb.id = #{id}
  550. </if>
  551. <if test="checkId != null">
  552. and sb.check_id = #{checkId}
  553. </if>
  554. <if test="isChild != null">
  555. and sb.is_child = #{isChild}
  556. </if>
  557. <if test="isFinancing != null">
  558. and sb.is_financing = #{isFinancing}
  559. </if>
  560. <if test="isShow != null">
  561. and sb.is_show = #{isShow}
  562. </if>
  563. <if test="useArea != null">
  564. and sb.use_area = #{useArea}
  565. </if>
  566. <if test="useCompany != null">
  567. and sb.use_company = #{useCompany}
  568. </if>
  569. <if test="useProject != null">
  570. and sb.use_project = #{useProject}
  571. </if>
  572. <if test="typeId != null">
  573. and sb.type_id = #{typeId}
  574. </if>
  575. <if test="model != null">
  576. and sb.model like concat('%',#{model},'%')
  577. </if>
  578. <if test="useDept != null">
  579. and sb.use_dept = #{useDept}
  580. </if>
  581. <if test="useGroup != null">
  582. and sb.use_group = #{useGroup}
  583. </if>
  584. <if test="baoyangTimes != null">
  585. and sb.baoyang_times = #{baoyangTimes}
  586. </if>
  587. <if test="nextCheckDateStart != null">
  588. and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
  589. </if>
  590. <if test="nextCheckDateEnd != null">
  591. and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
  592. </if>
  593. <if test="saveDept != null">
  594. and sb.save_dept = #{saveDept}
  595. </if>
  596. <if test="saveUser != null">
  597. and sb.save_user = #{saveUser}
  598. </if>
  599. <if test="status != null">
  600. and sb.status = #{status}
  601. </if>
  602. <if test="modelId != null">
  603. and sb.model_id = #{modelId}
  604. </if>
  605. <if test="notStatusList != null and notStatusList.size > 0">
  606. AND sb.status not in
  607. <foreach item="item" index="index" collection="notStatusList" open="(" close=")" separator=",">
  608. #{item}
  609. </foreach>
  610. </if>
  611. <if test="statusList != null and statusList.size > 0">
  612. AND sb.status in
  613. <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
  614. #{item}
  615. </foreach>
  616. </if>
  617. <if test="sbIds != null and sbIds.size > 0">
  618. AND sb.id in
  619. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  620. #{item}
  621. </foreach>
  622. </if>
  623. <if test="ascriptionDept != null and ascriptionDept">
  624. <include refid="deptSql"/>
  625. </if>
  626. </select>
  627. <select id="getById" parameterType="java.lang.Object" resultType="com.platform.dao.vo.sb.SbInfoVO">
  628. select
  629. <include refid="Left_Column"/>,parentPosition.name as parentPositionName,parentPosition.id as parentPositionId,
  630. sbType.name as sbTypeName,parentSbType.name as parentSbTypeName
  631. from t_sb_info sb
  632. left join t_sb_type sbType on sb.type_id = sbType.id
  633. left join t_sb_position position on sb.position_id = position.id
  634. left join t_sb_type parentSbType on parentSbType.id = sbType.parent_id
  635. left join t_sb_position parentPosition on parentPosition.id = position.parent_id
  636. where sb.id = #{value}
  637. </select>
  638. <select id="getByNo" parameterType="java.lang.Object" resultType="com.platform.dao.vo.sb.SbInfoVO">
  639. select
  640. <include refid="Left_Column"/>
  641. from t_sb_info sb
  642. left join t_sb_type sbType on sb.type_id = sbType.id
  643. left join t_sb_position position on sb.position_id = position.id
  644. where sb.no = #{value}
  645. </select>
  646. <select id="getByIds" parameterType="java.util.List" resultType="com.platform.dao.vo.sb.SbInfoVO">
  647. select
  648. <include refid="Left_Column"/>
  649. from t_sb_info sb
  650. where sb.id in
  651. <foreach item="item" index="index" collection="ids" open="(" close=")" separator=",">
  652. #{item}
  653. </foreach>
  654. </select>
  655. <select id="selectNameById" parameterType="Object" resultType="java.lang.String">
  656. select name
  657. from t_sb_info
  658. where id = #{value}
  659. </select>
  660. <select id="selectNoById" parameterType="Object" resultType="java.lang.String">
  661. select no
  662. from t_sb_info
  663. where id = #{value}
  664. </select>
  665. <update id="updateBatch" parameterType="java.util.List">
  666. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  667. update t_sb_info
  668. <set>
  669. <if test="item.measureStatus != null">
  670. measure_status= #{item.measureStatus}
  671. </if>
  672. </set>
  673. where id = #{item.id}
  674. </foreach>
  675. </update>
  676. <update id="updateBatchQrCode" parameterType="java.util.List">
  677. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  678. update t_sb_info
  679. <set>
  680. qr_code=#{item.qrCode}
  681. </set>
  682. where id = #{item.id}
  683. </foreach>
  684. </update>
  685. <update id="updateBatchChild" parameterType="java.util.List">
  686. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  687. update t_sb_info
  688. <set>
  689. parent_id = #{item.parentId}
  690. </set>
  691. where id = #{item.id}
  692. </foreach>
  693. </update>
  694. <update id="updateBatchValue" parameterType="java.util.List">
  695. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  696. update t_sb_info
  697. <set>
  698. initial_value=#{item.initialValue},
  699. current_value=#{item.currentValue},
  700. cut_value=#{item.cutValue},
  701. month=#{item.month},
  702. rate=#{item.rate},
  703. used_month=#{item.usedMonth}
  704. </set>
  705. where id = #{item.id}
  706. </foreach>
  707. </update>
  708. <update id="updateStatusByIds" parameterType="com.platform.dao.dto.sb.SbInfoDTO">
  709. update t_sb_info
  710. <set>
  711. status=${status}, update_time=#{updateTime,jdbcType=TIMESTAMP}
  712. </set>
  713. where
  714. id in
  715. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  716. #{item}
  717. </foreach>
  718. </update>
  719. <update id="updateTotalById" parameterType="java.util.List">
  720. <foreach collection="sbInfos" item="item" index="index" open="" close="" separator=";">
  721. update t_sb_info
  722. <set>
  723. <if test="item.totalHours != null">
  724. total_hours= total_hours+#{item.totalHours},
  725. </if>
  726. <if test="item.totalMiles != null">
  727. total_miles=total_miles+#{item.totalMiles},
  728. </if>
  729. </set>
  730. where id = #{item.id}
  731. </foreach>
  732. </update>
  733. <update id="updateBySbIds" parameterType="com.platform.dao.dto.sb.SbInfoDTO">
  734. update t_sb_info
  735. <set>
  736. <if test="useArea != null">
  737. use_area = #{useArea},
  738. </if>
  739. <if test="useCompany != null">
  740. use_company = #{useCompany},
  741. </if>
  742. <if test="useCompanyName != null">
  743. use_company_name = #{useCompanyName},
  744. </if>
  745. <if test="useProject != null">
  746. use_project = #{useProject},
  747. </if>
  748. <if test="useProjectName != null">
  749. use_project_name = #{useProjectName},
  750. </if>
  751. <if test="useDept != null">
  752. use_dept = #{useDept},
  753. </if>
  754. <if test="useDeptName != null">
  755. use_dept_name = #{useDeptName},
  756. </if>
  757. <if test="useGroup != null">
  758. use_group = #{useGroup},
  759. </if>
  760. <if test="useGroupName != null">
  761. use_group_name = #{useGroupName},
  762. </if>
  763. <if test="saveDept != null">
  764. save_dept = #{saveDept},
  765. </if>
  766. <if test="saveDeptName != null">
  767. save_dept_name = #{saveDeptName},
  768. </if>
  769. <if test="saveUser != null">
  770. save_user = #{saveUser},
  771. </if>
  772. <if test="status != null">
  773. status = #{status},
  774. </if>
  775. <if test="updateTime != null">
  776. update_time=#{updateTime,jdbcType=TIMESTAMP},
  777. </if>
  778. <if test="updateUserId != null">
  779. update_user_id = #{updateUserId},
  780. </if>
  781. <if test="updateUserName != null">
  782. update_user_name = #{updateUserName},
  783. </if>
  784. <if test="saveUserNull != null and saveUserNull">
  785. save_user = null,
  786. </if>
  787. </set>
  788. where
  789. id in
  790. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  791. #{item}
  792. </foreach>
  793. </update>
  794. <select id="getSbTree" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  795. resultType="com.platform.dao.vo.sb.SbTreeVO">
  796. SELECT info.id,info.name,bom.* FROM
  797. t_sb_info info JOIN t_sb_model_spare_bom bom ON
  798. info.id=bom.`sb_id`
  799. WHERE bom.sb_id=#{id}
  800. </select>
  801. <select id="getSubSb" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  802. resultType="com.platform.dao.vo.sb.SbInfoVO">
  803. select id,name from t_sb_info where parent_id=#{id}
  804. </select>
  805. <select id="selectCountByPosition" parameterType="java.lang.String"
  806. resultType="java.lang.Integer">
  807. select count(info.id)
  808. from t_sb_info info
  809. left join t_sb_position position on info.position_id = position.id
  810. where position.code like concat(#{code},'%')
  811. </select>
  812. <select id="selectCountByPositionGroup" parameterType="java.lang.String"
  813. resultType="java.util.Map">
  814. select position.id, position.name, position.code, position.type, position.parent_id parentId,
  815. count(info.id) as num
  816. from t_sb_position position
  817. left join t_sb_info info on info.position_id=position.id
  818. where position.type in (1, 2) and position.del_flag=0
  819. group By position.id
  820. </select>
  821. <select id="selectByPositionNo" parameterType="java.lang.String"
  822. resultType="com.platform.dao.vo.sb.SbInfoVO">
  823. select info.*
  824. from t_sb_info info
  825. where info.position_no = #{code}
  826. </select>
  827. <select id="selectCountByStatusGroup" parameterType="java.lang.String"
  828. resultType="java.util.Map">
  829. select info.status, count(info.id) as num
  830. from t_sb_info info, t_sb_position position
  831. where
  832. info.position_id = position.id
  833. and position.code like concat(#{code},'%') and position.del_flag=0
  834. group By info.status
  835. </select>
  836. <select id="selectCountByUseTypeGroup" parameterType="java.lang.String"
  837. resultType="java.util.Map">
  838. select info.use_type useType, count(info.id) as num
  839. from t_sb_info info, t_sb_position position
  840. where
  841. info.position_id = position.id
  842. and position.code like concat(#{code},'%') and position.del_flag=0
  843. group By info.use_type
  844. </select>
  845. <select id="selectCountMap" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  846. resultType="java.util.Map">
  847. select count(*) as num, type_id as typeId from t_sb_info
  848. <where>
  849. <if test="useType != null">
  850. and use_type = #{useType}
  851. </if>
  852. <if test="typeId!=null">
  853. and type_id = #{typeId}
  854. </if>
  855. <if test="typeList!=null and typeList.size>0">
  856. and type_id in
  857. <foreach collection="typeList" close=")" separator="," open="(" item="item">
  858. #{item}
  859. </foreach>
  860. </if>
  861. </where>
  862. GROUP BY type_id
  863. </select>
  864. <update id="updateLongYanForInStore" parameterType="com.platform.dao.dto.sb.SbInfoDTO">
  865. update t_sb_info set status = #{status},position_id = null,positionNo = null,ppNo = null,parentId = null where id = #{id}
  866. </update>
  867. <select id="countNum" parameterType="com.platform.dao.dto.sb.SbInfoDTO" resultType="java.lang.Integer">
  868. <if test="typeFlag != null">
  869. select count(1) from (
  870. </if>
  871. select count(1) from t_sb_info
  872. <where>
  873. <if test="positionId != null and positionId != ''">
  874. and position_id = #{positionId}
  875. </if>
  876. <if test="useType != null">
  877. and use_type = #{useType}
  878. </if>
  879. <if test="isMeasure != null">
  880. and is_measure = #{isMeasure}
  881. </if>
  882. <if test="measureStatus != null">
  883. and measure_status = #{measureStatus}
  884. </if>
  885. <choose>
  886. <when test="replenishFlag != null">
  887. <if test="replenishFlag == 1">
  888. and (position_no is null or position_no = '' or position_no = '暂无')
  889. </if>
  890. <if test="replenishFlag == 2">
  891. and (model is null or model = '' or model = '暂无')
  892. </if>
  893. <if test="replenishFlag == 3">
  894. and (financing_no is null or financing_no = '')
  895. </if>
  896. <if test="replenishFlag == 4">
  897. and (type_id is null or type_id = '' or type_id = '暂无')
  898. </if>
  899. </when>
  900. </choose>
  901. </where>
  902. <if test="typeFlag != null">
  903. group by type_id ) t
  904. </if>
  905. </select>
  906. <select id="getsbNumsByType" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  907. resultType="com.platform.dao.vo.report.SbInfoTypeReportVO2">
  908. select type.id as id count(1) as totalNum,type.name as typeName from t_sb_info info inner join t_sb_type type
  909. on info.type_id = type.id
  910. <where>
  911. <if test="useType!=null">
  912. info.use_type = #{useType}
  913. </if>
  914. </where>
  915. group by type.id
  916. </select>
  917. <select id="getChildIds" parameterType="java.lang.String"
  918. resultType="java.lang.String">
  919. select id from t_sb_type
  920. <where>
  921. <if test="sbIds!=null">
  922. and parent_id in
  923. <foreach collection="sbIds" item="item" open="(" separator="," close=")">
  924. #{item}
  925. </foreach>
  926. </if>
  927. </where>
  928. </select>
  929. <!-- <select id="getPositionNoHistory" parameterType="com.platform.dao.dto.sb.SbInfoDTO"-->
  930. <!-- resultType="com.platform.dao.vo.sb.SbInfoVO">-->
  931. <!-- select record.sb_no_id,sb.name as sbName,record.created_time ,record.created_user_id,record.creaed_user_name,-->
  932. <!-- from t_sb_info sb left join t_sb_change_record record-->
  933. <!-- on sb.id = record.sb_id-->
  934. <!-- <where>-->
  935. <!-- <if test="useType!=null">-->
  936. <!-- sb.use_type=#{useType}-->
  937. <!-- </if>-->
  938. <!-- </where>-->
  939. <!-- </select>-->
  940. <select id="selectList2" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
  941. resultType="java.lang.String">
  942. select distinct (info.id) from t_sb_info info inner join t_long_yan_purchase_order orders
  943. on info.id = orders.sb_id
  944. <where>
  945. 1 = 1
  946. <if test="keyword != null and keyword != ''">
  947. and (
  948. sb.name like concat('%',#{keyword},'%')
  949. or sb.no like concat('%',#{keyword},'%')
  950. or sb.position_no like concat('%',#{keyword},'%')
  951. or sb.remark like concat('%',#{keyword},'%')
  952. )
  953. </if>
  954. <if test="name != null and name!=''">
  955. and sb.name like concat('%',#{name},'%')
  956. </if>
  957. <if test="zbh != null and zbh!=''">
  958. and sb.zbh like concat('%',#{zbh},'%')
  959. </if>
  960. <if test="producerName != null and producerName!=''">
  961. and sb.producer_id like concat('%',#{producerName},'%')
  962. </if>
  963. <if test="producerId != null and producerId!=''">
  964. and sb.producer_id like concat('%',#{producerId},'%')
  965. </if>
  966. <if test="positionId != null and positionId!=''">
  967. and sb.position_id = #{positionId}
  968. </if>
  969. <if test="positionNo != null and positionNo!=''">
  970. and sb.position_no like concat('%',#{positionNo},'%')
  971. </if>
  972. <if test="ppNo != null and ppNo!=''">
  973. and sb.pp_no like concat('%',#{ppNo},'%')
  974. </if>
  975. <if test="likeDeptCode != null and likeDeptCode!=''">
  976. and sdDept.dept_code like concat(#{likeDeptCode},'%')
  977. </if>
  978. <if test="financingNo != null and financingNo!=''">
  979. and sb.financing_no like concat(#{financingNo},'%')
  980. </if>
  981. <if test="positionIds != null">
  982. AND sb.position_id in
  983. <foreach item="item" index="index" collection="positionIds" open="(" close=")" separator=",">
  984. #{item}
  985. </foreach>
  986. </if>
  987. <if test="ids != null">
  988. AND sb.id in
  989. <foreach item="item" index="index" collection="ids" open="(" close=")" separator=",">
  990. #{item}
  991. </foreach>
  992. </if>
  993. <if test="typeList != null">
  994. AND sb.type_id in
  995. <foreach item="item" index="index" collection="typeList" open="(" close=")" separator=",">
  996. #{item}
  997. </foreach>
  998. </if>
  999. <if test="useType != null">
  1000. and sb.use_type = #{useType}
  1001. </if>
  1002. <if test="id != null">
  1003. and sb.id = #{id}
  1004. </if>
  1005. <if test="checkId != null">
  1006. and sb.check_id = #{checkId}
  1007. </if>
  1008. <if test="isChild != null">
  1009. and sb.is_child = #{isChild}
  1010. </if>
  1011. <if test="isMeasure != null">
  1012. and sb.is_measure = #{isMeasure}
  1013. </if>
  1014. <if test="isSelf != null">
  1015. and sb.is_self = #{isSelf}
  1016. </if>
  1017. <if test="measureStatus != null">
  1018. and sb.measure_status = #{measureStatus}
  1019. </if>
  1020. <if test="isShow != null">
  1021. and sb.is_show = #{isShow}
  1022. </if>
  1023. <if test="isFinancing != null">
  1024. and sb.is_financing = #{isFinancing}
  1025. </if>
  1026. <if test="useArea != null">
  1027. and sb.use_area = #{useArea}
  1028. </if>
  1029. <if test="useCompany != null">
  1030. and sb.use_company = #{useCompany}
  1031. </if>
  1032. <if test="useProject != null">
  1033. and sb.use_project = #{useProject}
  1034. </if>
  1035. <if test="baoyangTimes != null">
  1036. and sb.baoyang_times = #{baoyangTimes}
  1037. </if>
  1038. <if test="typeId != null and typeId != ''">
  1039. and sb.type_id = #{typeId}
  1040. </if>
  1041. <if test="parentId != null">
  1042. and sb.parent_id = #{parentId}
  1043. </if>
  1044. <if test="model != null">
  1045. and sb.model like concat('%',#{model},'%')
  1046. </if>
  1047. <if test="cph != null">
  1048. and sb.model like concat('%',#{cph},'%')
  1049. </if>
  1050. <if test="useDept != null">
  1051. and sb.use_dept = #{useDept}
  1052. </if>
  1053. <if test="useGroup != null">
  1054. and sb.use_group = #{useGroup}
  1055. </if>
  1056. <if test="saveDept != null">
  1057. and sb.save_dept = #{saveDept}
  1058. </if>
  1059. <if test="saveUser != null">
  1060. and sb.save_user = #{saveUser}
  1061. </if>
  1062. <if test="checkDateStart != null">
  1063. and sb.check_date <![CDATA[ >= ]]> #{checkDateStart}
  1064. </if>
  1065. <if test="checkDateEnd != null">
  1066. and sb.check_date <![CDATA[ <= ]]> #{checkDateEnd}
  1067. </if>
  1068. <if test="nextCheckDateStart != null">
  1069. and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
  1070. </if>
  1071. <if test="nextCheckDateEnd != null">
  1072. and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
  1073. </if>
  1074. <if test="repairUser != null">
  1075. and sb.repair_user = #{repairUser}
  1076. </if>
  1077. <if test="repairUserSecond != null">
  1078. and sb.repair_user_second = #{repairUserSecond}
  1079. </if>
  1080. <if test="repairUserSearch != null">
  1081. and (
  1082. sb.repair_user = #{repairUserSearch}
  1083. or
  1084. sb.repair_user_second = #{repairUserSearch}
  1085. )
  1086. </if>
  1087. <if test="status != null">
  1088. and sb.status = #{status}
  1089. </if>
  1090. <if test="modelId != null">
  1091. and sb.model_id = #{modelId}
  1092. </if>
  1093. <if test="notStatusList != null and notStatusList.size > 0">
  1094. AND sb.status not in
  1095. <foreach item="item" index="index" collection="notStatusList" open="(" close=")" separator=",">
  1096. #{item}
  1097. </foreach>
  1098. </if>
  1099. <if test="statusList != null and statusList.size > 0">
  1100. AND sb.status in
  1101. <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
  1102. #{item}
  1103. </foreach>
  1104. </if>
  1105. <if test="sbIds != null and sbIds.size > 0">
  1106. AND sb.id in
  1107. <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
  1108. #{item}
  1109. </foreach>
  1110. </if>
  1111. <if test="checkType!=null">
  1112. and sb.check_type = #{checkType}
  1113. </if>
  1114. <if test="ascriptionDept != null and ascriptionDept">
  1115. <include refid="deptSql"/>
  1116. </if>
  1117. </where>
  1118. </select>
  1119. </mapper>