BoilerTaskOrderMapper.xml 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  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="cn.start.tz.module.pressure2.dal.mysql.boilertaskorder.BoilerTaskOrderMapper">
  4. <!--
  5. 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  6. 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  7. 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  8. 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
  9. -->
  10. <select id="selectPage">
  11. select rownum,a.* from (
  12. select bto.* from PRESSURE_TASK_ORDER bto
  13. <where>
  14. bto.DELETED = 0 and bto.EQUIP_MAIN_TYPE = 200
  15. <if test="orderNo != null and orderNo != ''">
  16. AND bto.ORDER_NO LIKE CONCAT('%',#{orderNo},'%')
  17. </if>
  18. <if test="unitName != null and unitName != ''">
  19. AND bto.UNIT_NAME LIKE CONCAT('%',#{unitName},'%')
  20. </if>
  21. <if test="checkType != null and checkType != ''">
  22. AND bto.CHECK_TYPE = #{checkType}
  23. </if>
  24. <if test="deptId != null and deptId != ''">
  25. AND bto.DEPT_ID = #{deptId}
  26. </if>
  27. <if test="equipMainType != null and equipMainType != ''">
  28. AND bto.EQUIP_MAIN_TYPE = #{equipMainType}
  29. </if>
  30. <if test="checkDate != null and checkDate.size() >= 2">
  31. AND bto.CHECK_DATE BETWEEN #{checkDate[0]} AND #{checkDate[1]}
  32. </if>
  33. <if test="contractNo != null and contractNo != ''">
  34. AND bto.CONTRACT_NO LIKE CONCAT('%',#{contractNo},'%')
  35. </if>
  36. <if test="taskStatus != null and taskStatus != ''">
  37. AND bto.TASK_STATUS = #{taskStatus}
  38. </if>
  39. <if test="checkUserIds != null and checkUserIds.size() >= 1">
  40. AND bto.ID in (
  41. <choose>
  42. <when test="equipMainType != null and equipMainType == '100'">
  43. select tu.ORDER_ID from PRESSURE_TASK_ORDER_USER tu
  44. left join SYSTEM_USERS u on u.ID = tu.USER_ID
  45. where tu.deleted = 0 and tu.USER_ID IN
  46. <foreach close=")" collection="checkUserIds" item="listItem" open="(" separator=",">
  47. #{listItem}
  48. </foreach>
  49. </when>
  50. <when test="equipMainType != null and equipMainType == '200'">
  51. select tu.ORDER_ID from pressure2_boiler_task_order_user tu
  52. left join SYSTEM_USERS u on u.ID = tu.USER_ID
  53. where tu.deleted = 0 and tu.USER_ID IN
  54. <foreach close=")" collection="checkUserIds" item="listItem" open="(" separator=",">
  55. #{listItem}
  56. </foreach>
  57. </when>
  58. <when test="equipMainType != null and equipMainType == '300'">
  59. select tu.ORDER_ID from pressure2_pipe_task_order_user tu
  60. left join SYSTEM_USERS u on u.ID = tu.USER_ID
  61. where tu.deleted = 0 and tu.USER_ID IN
  62. <foreach close=")" collection="checkUserIds" item="listItem" open="(" separator=",">
  63. #{listItem}
  64. </foreach>
  65. </when>
  66. <otherwise>
  67. select tu.ORDER_ID from (
  68. select ORDER_ID, USER_ID from pressure2_boiler_task_order_user where deleted = 0
  69. union all
  70. select ORDER_ID, USER_ID from pressure2_pipe_task_order_user where deleted = 0
  71. ) tu
  72. left join SYSTEM_USERS u on u.ID = tu.USER_ID
  73. where tu.USER_ID IN
  74. <foreach close=")" collection="checkUserIds" item="listItem" open="(" separator=",">
  75. #{listItem}
  76. </foreach>
  77. </otherwise>
  78. </choose>
  79. )
  80. </if>
  81. <if test="submitIds != null and submitIds.size() >= 1">
  82. AND bto.SUBMIT_ID IN
  83. <foreach close=")" collection="submitIds" item="listItem" open="(" separator=",">
  84. #{listItem}
  85. </foreach>
  86. </if>
  87. <if test="deptId != null and deptId != ''">
  88. AND bto.DEPT_ID = #{deptId}
  89. </if>
  90. <if test="submitTime != null and submitTime.size() >= 2">
  91. AND bto.SUBMIT_TIME BETWEEN #{submitTime[0]} AND #{submitTime[1]}
  92. </if>
  93. <if test="status != null and status != ''">
  94. AND bto.STATUS = #{status}
  95. </if>
  96. <if test="permissionUserId != null and permissionUserId != ''">
  97. AND ( bto.MANAGER_ID = #{permissionUserId}
  98. or bto.ID in (
  99. <choose>
  100. <when test="equipMainType != null and equipMainType == '100'">
  101. select tu.ORDER_ID from PRESSURE_TASK_ORDER_USER tu
  102. where tu.deleted = 0 and tu.USER_ID = #{permissionUserId}
  103. </when>
  104. <when test="equipMainType != null and equipMainType == '200'">
  105. select tu.ORDER_ID from pressure2_boiler_task_order_user tu
  106. where tu.deleted = 0 and tu.USER_ID = #{permissionUserId}
  107. </when>
  108. <when test="equipMainType != null and equipMainType == '300'">
  109. select tu.ORDER_ID from pressure2_pipe_task_order_user tu
  110. where tu.deleted = 0 and tu.USER_ID = #{permissionUserId}
  111. </when>
  112. <otherwise>
  113. select tu.ORDER_ID from (
  114. select ORDER_ID, USER_ID from pressure2_boiler_task_order_user where deleted = 0
  115. union all
  116. select ORDER_ID, USER_ID from pressure2_pipe_task_order_user where deleted = 0
  117. ) tu
  118. where tu.USER_ID = #{permissionUserId}
  119. </otherwise>
  120. </choose>
  121. ) )
  122. </if>
  123. <if test="permissionDeptIds != null and permissionDeptIds != ''">
  124. AND ( bto.DEPT_ID in
  125. <foreach close=")" collection="permissionDeptIds" item="listItem" open="(" separator=",">
  126. #{listItem}
  127. </foreach>
  128. )
  129. </if>
  130. <if test="hasPermission != null and hasPermission == false">
  131. AND 1 = 2
  132. </if>
  133. </where>
  134. order by bto.CREATE_TIME desc
  135. ) a
  136. OFFSET ${(pageNo - 1) * pageSize} ROWS FETCH NEXT #{pageSize} ROWS ONLY
  137. </select>
  138. <select id="selectPageCount">
  139. select count(1) from (
  140. select bto.* from PRESSURE_TASK_ORDER bto
  141. <where>
  142. bto.DELETED = 0 and bto.EQUIP_MAIN_TYPE = 200
  143. <if test="orderNo != null and orderNo != ''">
  144. AND bto.ORDER_NO LIKE CONCAT('%',#{orderNo},'%')
  145. </if>
  146. <if test="unitName != null and unitName != ''">
  147. AND bto.UNIT_NAME LIKE CONCAT('%',#{unitName},'%')
  148. </if>
  149. <if test="checkType != null and checkType != ''">
  150. AND bto.CHECK_TYPE = #{checkType}
  151. </if>
  152. <if test="checkDate != null and checkDate.size() >= 2">
  153. AND bto.CHECK_DATE BETWEEN #{checkDate[0]} AND #{checkDate[1]}
  154. </if>
  155. <if test="contractNo != null and contractNo != ''">
  156. AND bto.CONTRACT_NO LIKE CONCAT('%',#{contractNo},'%')
  157. </if>
  158. <if test="taskStatus != null and taskStatus != ''">
  159. AND bto.TASK_STATUS = #{taskStatus}
  160. </if>
  161. <if test="checkUserIds != null and checkUserIds.size() >= 1">
  162. AND bto.ID in (select tu.ORDER_ID from pressure2_boiler_task_order_user tu
  163. where tu.deleted = 0 and tu.USER_ID IN
  164. <foreach close=")" collection="checkUserIds" item="listItem" open="(" separator=",">
  165. #{listItem}
  166. </foreach>
  167. )
  168. </if>
  169. <if test="submitIds != null and submitIds.size() >= 1">
  170. AND bto.SUBMIT_ID IN
  171. <foreach close=")" collection="submitIds" item="listItem" open="(" separator=",">
  172. #{listItem}
  173. </foreach>
  174. </if>
  175. <if test="deptId != null and deptId != ''">
  176. AND bto.DEPT_ID = #{deptId}
  177. </if>
  178. <if test="submitTime != null and submitTime.size() >= 2">
  179. AND bto.SUBMIT_TIME BETWEEN #{submitTime[0]} AND #{submitTime[1]}
  180. </if>
  181. <if test="status != null and status != ''">
  182. AND bto.STATUS = #{status}
  183. </if>
  184. <if test="permissionUserId != null and permissionUserId != ''">
  185. AND ( bto.MANAGER_ID = #{permissionUserId}
  186. or bto.ID in (select tu.ORDER_ID from pressure2_boiler_task_order_user tu
  187. where tu.deleted = 0 and tu.USER_ID = #{permissionUserId} ) )
  188. </if>
  189. <if test="permissionDeptIds != null and permissionDeptIds != ''">
  190. AND ( bto.DEPT_ID in
  191. <foreach close=")" collection="permissionDeptIds" item="listItem" open="(" separator=",">
  192. #{listItem}
  193. </foreach>
  194. )
  195. </if>
  196. <if test="hasPermission != null and hasPermission == false">
  197. AND 1 = 2
  198. </if>
  199. </where>
  200. ) a
  201. </select>
  202. <select id="selectItemPage">
  203. select rownum,a.* from (
  204. select DISTINCT tt.ID
  205. ,bto.ID as ORDER_ID
  206. ,bto.ORDER_NO
  207. ,eb.EQUIP_CODE
  208. ,eb.EQUIP_NAME
  209. ,eb.UNIT_NAME
  210. ,bto.CHECK_TYPE
  211. ,bto.DEPT_ID
  212. ,btoir.TASK_STATUS
  213. ,bto.CHECK_DATE
  214. ,bto.MANAGER_ID
  215. ,tt.MAIN_CHECKER
  216. ,tt.END_CHECK_DATE
  217. ,bto.CREATE_TIME
  218. -- 设备任务
  219. from PRESSURE2_BOILER_TASK_ORDER_ITEM tt
  220. left join PRESSURE2_EQUIP_BOILER eb on tt.EQUIP_ID = eb.ID
  221. left join PRESSURE_TASK_ORDER bto on bto.ID = tt.ORDER_ID and bto.EQUIP_MAIN_TYPE = 200
  222. left join PRESSURE2_BOILER_TASK_ORDER_ITEM_REPORT btoir on btoir.ORDER_ITEM_ID = tt.ID and btoir.REPORT_TYPE = 100
  223. <where>tt.DELETED = 0
  224. AND eb.DELETED = 0
  225. AND bto.DELETED = 0 and btoir.DELETED = 0
  226. -- 只显示已认领的任务单
  227. AND bto.TASK_STATUS = 400
  228. <if test="isClaim != null">
  229. <if test="isClaim == 'unclaim'">
  230. AND (tt.MAIN_CHECKER IS NULL OR tt.MAIN_CHECKER = '')
  231. </if>
  232. <if test="isClaim == 'claim'">
  233. AND (tt.MAIN_CHECKER IS NOT NULL AND tt.MAIN_CHECKER != '')
  234. </if>
  235. </if>
  236. <if test="taskStatusList != null and taskStatusList.size() > 0">
  237. AND btoir.TASK_STATUS IN
  238. <foreach collection="taskStatusList" item="taskStatus" open="(" separator="," close=")">
  239. #{taskStatus}
  240. </foreach>
  241. </if>
  242. <if test="unitCode != null and unitCode != ''">
  243. AND bto.UNIT_CODE LIKE CONCAT('%',#{unitCode},'%')
  244. </if>
  245. <if test="equipCode != null and equipCode != ''">
  246. AND eb.EQUIP_CODE LIKE CONCAT('%',#{equipCode},'%')
  247. </if>
  248. <if test="orderNo != null and orderNo != ''">
  249. AND bto.ORDER_NO LIKE CONCAT('%',#{orderNo},'%')
  250. </if>
  251. <if test="unitName != null and unitName != ''">
  252. AND bto.UNIT_NAME LIKE CONCAT('%',#{unitName},'%')
  253. </if>
  254. <if test="checkType != null and checkType != ''">
  255. AND bto.CHECK_TYPE = #{checkType}
  256. </if>
  257. <if test="deptId != null and deptId != ''">
  258. AND bto.DEPT_ID = #{deptId}
  259. </if>
  260. <if test="orderId != null and orderId != ''">
  261. AND bto.ID = #{orderId}
  262. </if>
  263. <if test="checkDate != null and checkDate.size() >= 2">
  264. AND bto.CHECK_DATE BETWEEN #{checkDate[0]} AND #{checkDate[1]}
  265. </if>
  266. <if test="mainCheckerIds != null and mainCheckerIds.size() > 0">
  267. AND tt.MAIN_CHECKER IN
  268. <foreach collection="mainCheckerIds" item="mainCheckerId" open="(" separator="," close=")">
  269. #{mainCheckerId}
  270. </foreach>
  271. </if>
  272. <if test="managerIds != null and managerIds.size() > 0">
  273. AND bto.MANAGER_ID IN
  274. <foreach collection="managerIds" item="managerId" open="(" separator="," close=")">
  275. #{managerId}
  276. </foreach>
  277. </if>
  278. <if test="checkUserIds != null and checkUserIds.size() > 0">
  279. AND bto.ID in (select ORDER_ID from PRESSURE2_BOILER_TASK_ORDER_USER where DELETED = 0 and USER_ID IN
  280. <foreach collection="checkUserIds" item="checkUserId" open="(" separator="," close=")">
  281. #{checkUserId}
  282. </foreach>
  283. )
  284. </if>
  285. <if test="permissionUserId != null and permissionUserId != ''">
  286. AND ( bto.MANAGER_ID = #{permissionUserId}
  287. or bto.ID in (select tu.ORDER_ID from pressure2_boiler_task_order_user tu
  288. where tu.deleted = 0 and tu.USER_ID = #{permissionUserId} ) )
  289. </if>
  290. <if test="permissionDeptIds != null and permissionDeptIds != ''">
  291. AND ( bto.DEPT_ID in
  292. <foreach close=")" collection="permissionDeptIds" item="listItem" open="(" separator=",">
  293. #{listItem}
  294. </foreach>
  295. )
  296. </if>
  297. <if test="hasPermission != null and hasPermission == false">
  298. AND 1 = 2
  299. </if>
  300. </where>
  301. order by bto.CREATE_TIME desc
  302. ) a
  303. OFFSET ${(pageNo - 1) * pageSize} ROWS FETCH NEXT #{pageSize} ROWS ONLY
  304. </select>
  305. <select id="selectItemPageCount">
  306. select count(1) from (
  307. select DISTINCT tt.ID,bto.ORDER_NO,eb.EQUIP_CODE,eb.UNIT_NAME,bto.CHECK_TYPE,btoir.TASK_STATUS
  308. ,bto.CHECK_DATE,bto.MANAGER_ID,tt.MAIN_CHECKER,tt.END_CHECK_DATE,bto.CREATE_TIME
  309. -- 设备任务
  310. from PRESSURE2_BOILER_TASK_ORDER_ITEM tt
  311. left join PRESSURE2_EQUIP_BOILER eb on tt.EQUIP_ID = eb.ID
  312. left join PRESSURE_TASK_ORDER bto on bto.ID = tt.ORDER_ID and bto.EQUIP_MAIN_TYPE = 200
  313. left join PRESSURE2_BOILER_TASK_ORDER_ITEM_REPORT btoir on btoir.ORDER_ITEM_ID = tt.ID and btoir.REPORT_TYPE = 100
  314. <where>
  315. tt.DELETED = 0 and eb.DELETED = 0 and bto.DELETED = 0 and btoir.DELETED = 0
  316. -- 只显示已认领的任务单
  317. AND bto.TASK_STATUS = 400
  318. <if test="isClaim != null">
  319. <if test="isClaim == 'unclaim'">
  320. AND (tt.MAIN_CHECKER IS NULL OR tt.MAIN_CHECKER = '')
  321. </if>
  322. <if test="isClaim == 'claim'">
  323. AND (tt.MAIN_CHECKER IS NOT NULL AND tt.MAIN_CHECKER != '')
  324. </if>
  325. </if>
  326. <if test="taskStatusList != null and taskStatusList.size() > 0">
  327. AND btoir.TASK_STATUS IN
  328. <foreach collection="taskStatusList" item="taskStatus" open="(" separator="," close=")">
  329. #{taskStatus}
  330. </foreach>
  331. </if>
  332. <if test="unitCode != null and unitCode != ''">
  333. AND bto.UNIT_CODE LIKE CONCAT('%',#{unitCode},'%')
  334. </if>
  335. <if test="equipCode != null and equipCode != ''">
  336. AND eb.EQUIP_CODE LIKE CONCAT('%',#{equipCode},'%')
  337. </if>
  338. <if test="orderNo != null and orderNo != ''">
  339. AND bto.ORDER_NO LIKE CONCAT('%',#{orderNo},'%')
  340. </if>
  341. <if test="unitName != null and unitName != ''">
  342. AND bto.UNIT_NAME LIKE CONCAT('%',#{unitName},'%')
  343. </if>
  344. <if test="checkType != null and checkType != ''">
  345. AND bto.CHECK_TYPE = #{checkType}
  346. </if>
  347. <if test="orderId != null and orderId != ''">
  348. AND bto.ID = #{orderId}
  349. </if>
  350. <if test="checkDate != null and checkDate.size() >= 2">
  351. AND bto.CHECK_DATE BETWEEN #{checkDate[0]} AND #{checkDate[1]}
  352. </if>
  353. <if test="mainCheckerIds != null and mainCheckerIds.size() > 0">
  354. AND tt.MAIN_CHECKER IN
  355. <foreach collection="mainCheckerIds" item="mainCheckerId" open="(" separator="," close=")">
  356. #{mainCheckerId}
  357. </foreach>
  358. </if>
  359. <if test="managerIds != null and managerIds.size() > 0">
  360. AND bto.MANAGER_ID IN
  361. <foreach collection="managerIds" item="managerId" open="(" separator="," close=")">
  362. #{managerId}
  363. </foreach>
  364. </if>
  365. <if test="checkUserIds != null and checkUserIds.size() > 0">
  366. AND bto.ID in (select ORDER_ID from PRESSURE2_BOILER_TASK_ORDER_USER where DELETED = 0 and USER_ID IN
  367. <foreach collection="checkUserIds" item="checkUserId" open="(" separator="," close=")">
  368. #{checkUserId}
  369. </foreach>
  370. )
  371. </if>
  372. <if test="permissionUserId != null and permissionUserId != ''">
  373. AND ( bto.MANAGER_ID = #{permissionUserId}
  374. or bto.ID in (select tu.ORDER_ID from pressure2_boiler_task_order_user tu
  375. where tu.deleted = 0 and tu.USER_ID = #{permissionUserId} ) )
  376. </if>
  377. <if test="permissionDeptIds != null and permissionDeptIds != ''">
  378. AND ( bto.DEPT_ID in
  379. <foreach close=")" collection="permissionDeptIds" item="listItem" open="(" separator=",">
  380. #{listItem}
  381. </foreach>
  382. )
  383. </if>
  384. <if test="hasPermission != null and hasPermission == false">
  385. AND 1 = 2
  386. </if>
  387. </where>
  388. ) a
  389. </select>
  390. <select id="selectBoilersPage">
  391. select rownum,a.* from (
  392. select eb.id,eb.unit_code,eb.unit_name,eb.equip_code,eb.equip_street ,eb.equip_district ,eb.USE_REGISTER_NO,
  393. eb.CONTACT,eb.CONTACT_PHONE,eb.USE_STATUS as status,
  394. eb.TONNAGE,eb.PRODUCT_CODE,eb.MAX_CONTINUE_EVAPOR,eb.NEXT_IN_CHECK_DATE,
  395. eb.NEXT_OUT_CHECK_DATE,eb.NEXT_PRESSURE_CHECK_DATE,eb.BOILER_MODEL,
  396. eb.FACTORY_CODE
  397. ,(select a.PLAN_DATE from PRESSURE2_EQUIP_BOILER_SCHEDULING a
  398. left join PRESSURE2_EQUIP_BOILER_SCHEDULING_ITEM b on a.ID = b.SCHEDULING_ID
  399. where b.equip_id = eb.id and a.DELETED = 0 and b.DELETED = 0 and a.type = 100 limit 1) plan_in_check_date
  400. ,(select a.PLAN_DATE from PRESSURE2_EQUIP_BOILER_SCHEDULING a
  401. left join PRESSURE2_EQUIP_BOILER_SCHEDULING_ITEM b on a.ID = b.SCHEDULING_ID
  402. where b.equip_id = eb.id and a.DELETED = 0 and b.DELETED = 0 and a.type = 200 limit 1) plan_out_check_date
  403. ,(select a.PLAN_DATE from PRESSURE2_EQUIP_BOILER_SCHEDULING a
  404. left join PRESSURE2_EQUIP_BOILER_SCHEDULING_ITEM b on a.ID = b.SCHEDULING_ID
  405. where b.equip_id = eb.id and a.DELETED = 0 and b.DELETED = 0 and a.type = 300 limit 1) plan_pre_check_date
  406. from PRESSURE2_EQUIP_BOILER eb
  407. <where>
  408. eb.deleted = 0
  409. <if test="unitName != null and unitName != ''">
  410. AND eb.unit_name LIKE CONCAT('%',#{unitName},'%')
  411. </if>
  412. <if test="unitCode != null">
  413. and eb.unit_code = #{unitCode}
  414. </if>
  415. <if test="unitAddress != null and unitAddress != ''">
  416. AND eb.unit_address LIKE CONCAT('%',#{unitAddress},'%')
  417. </if>
  418. <if test="equipCode != null and equipCode != ''">
  419. AND eb.equip_code LIKE CONCAT('%',#{equipCode},'%')
  420. </if>
  421. <if test="deptId != null and deptId != ''">
  422. AND eb.RELATED_DEPARTMENT = #{deptId}
  423. </if>
  424. <if test="equipStreet != null and equipStreet.size() > 0">
  425. AND eb.equip_street IN
  426. <foreach close=")" collection="equipStreet" item="listItem" open="(" separator=",">
  427. #{listItem}
  428. </foreach>
  429. </if>
  430. <if test="equipDistrict != null and equipDistrict.size() > 0">
  431. AND eb.equip_district IN
  432. <foreach close=")" collection="equipDistrict" item="listItem" open="(" separator=",">
  433. #{listItem}
  434. </foreach>
  435. </if>
  436. <if test="nextDate != null and nextDate.size() >= 2">
  437. AND (
  438. (eb.NEXT_IN_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
  439. OR (eb.NEXT_OUT_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
  440. OR (eb.NEXT_PRESSURE_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
  441. )
  442. </if>
  443. <if test="typeList != null and typeList.size() > 0">
  444. AND eb.type IN
  445. <foreach close=")" collection="typeList" item="listItem" open="(" separator=",">
  446. #{listItem}
  447. </foreach>
  448. </if>
  449. <if test="useStatus != null and useStatus.size() > 0">
  450. AND eb.USE_STATUS IN
  451. <foreach close=")" collection="useStatus" item="listItem" open="(" separator=",">
  452. #{listItem}
  453. </foreach>
  454. </if>
  455. <if test="orderId != null and orderId != ''">
  456. AND eb.ID IN (
  457. select EQUIP_ID from PRESSURE2_BOILER_TASK_ORDER_ITEM where ORDER_ID = #{orderId} and DELETED = 0
  458. )
  459. </if>
  460. <if test="notOrderId != null and notOrderId != ''">
  461. AND eb.ID NOT IN (
  462. select EQUIP_ID from PRESSURE2_BOILER_TASK_ORDER_ITEM where ORDER_ID = #{notOrderId} and DELETED = 0
  463. )
  464. </if>
  465. </where>
  466. ) a
  467. OFFSET ${(pageNo - 1) * pageSize} ROWS FETCH NEXT #{pageSize} ROWS ONLY
  468. </select>
  469. <select id="selectBoilersPageCount">
  470. select count(1) from (
  471. select eb.id,eb.unit_code,eb.unit_name,eb.equip_code,eb.equip_street ,eb.equip_district ,eb.USE_REGISTER_NO,
  472. eb.CONTACT,eb.CONTACT_PHONE,eb.STATUS,
  473. eb.TONNAGE,eb.PRODUCT_CODE,eb.MAX_CONTINUE_EVAPOR,eb.NEXT_IN_CHECK_DATE,
  474. eb.NEXT_OUT_CHECK_DATE,eb.NEXT_PRESSURE_CHECK_DATE,eb.BOILER_MODEL
  475. ,(select a.PLAN_DATE from PRESSURE2_EQUIP_BOILER_SCHEDULING a
  476. left join PRESSURE2_EQUIP_BOILER_SCHEDULING_ITEM b on a.ID = b.SCHEDULING_ID
  477. where b.equip_id = eb.id and a.DELETED = 0 and b.DELETED = 0 and a.type = 100 limit 1) plan_in_check_date
  478. ,(select a.PLAN_DATE from PRESSURE2_EQUIP_BOILER_SCHEDULING a
  479. left join PRESSURE2_EQUIP_BOILER_SCHEDULING_ITEM b on a.ID = b.SCHEDULING_ID
  480. where b.equip_id = eb.id and a.DELETED = 0 and b.DELETED = 0 and a.type = 200 limit 1) plan_out_check_date
  481. ,(select a.PLAN_DATE from PRESSURE2_EQUIP_BOILER_SCHEDULING a
  482. left join PRESSURE2_EQUIP_BOILER_SCHEDULING_ITEM b on a.ID = b.SCHEDULING_ID
  483. where b.equip_id = eb.id and a.DELETED = 0 and b.DELETED = 0 and a.type = 300 limit 1) plan_pre_check_date
  484. from PRESSURE2_EQUIP_BOILER eb
  485. <where>
  486. eb.deleted = 0
  487. <if test="unitName != null and unitName != ''">
  488. AND eb.unit_name LIKE CONCAT('%',#{unitName},'%')
  489. </if>
  490. <if test="unitCode != null">
  491. and eb.unit_code = #{unitCode}
  492. </if>
  493. <if test="unitAddress != null and unitAddress != ''">
  494. AND eb.unit_address LIKE CONCAT('%',#{unitAddress},'%')
  495. </if>
  496. <if test="equipCode != null and equipCode != ''">
  497. AND eb.equip_code LIKE CONCAT('%',#{equipCode},'%')
  498. </if>
  499. <if test="deptId != null and deptId != ''">
  500. AND eb.RELATED_DEPARTMENT = #{deptId}
  501. </if>
  502. <if test="useStatus != null and useStatus.size() > 0">
  503. AND eb.USE_STATUS IN
  504. <foreach close=")" collection="useStatus" item="listItem" open="(" separator=",">
  505. #{listItem}
  506. </foreach>
  507. </if>
  508. <if test="equipStreet != null and equipStreet.size() > 0">
  509. AND eb.equip_street IN
  510. <foreach close=")" collection="equipStreet" item="listItem" open="(" separator=",">
  511. #{listItem}
  512. </foreach>
  513. </if>
  514. <if test="equipDistrict != null and equipDistrict.size() > 0">
  515. AND eb.equip_district IN
  516. <foreach close=")" collection="equipDistrict" item="listItem" open="(" separator=",">
  517. #{listItem}
  518. </foreach>
  519. </if>
  520. <if test="nextDate != null and nextDate.size() >= 2">
  521. AND (
  522. (eb.NEXT_IN_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
  523. OR (eb.NEXT_OUT_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
  524. OR (eb.NEXT_PRESSURE_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
  525. )
  526. </if>
  527. <if test="typeList != null and typeList.size() > 0">
  528. AND eb.type IN
  529. <foreach close=")" collection="typeList" item="listItem" open="(" separator=",">
  530. #{listItem}
  531. </foreach>
  532. </if>
  533. <if test="orderId != null and orderId != ''">
  534. AND eb.ID IN (
  535. select EQUIP_ID from PRESSURE2_BOILER_TASK_ORDER_ITEM where ORDER_ID = #{orderId} and DELETED = 0
  536. )
  537. </if>
  538. <if test="notOrderId != null and notOrderId != ''">
  539. AND eb.ID NOT IN (
  540. select EQUIP_ID from PRESSURE2_BOILER_TASK_ORDER_ITEM where ORDER_ID = #{notOrderId} and DELETED = 0
  541. )
  542. </if>
  543. </where>
  544. ) a
  545. </select>
  546. </mapper>