| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="cn.start.tz.module.pressure2.dal.mysql.boilertaskorder.BoilerTaskOrderMapper">
- <!--
- 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
- 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
- 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
- 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
- -->
- <select id="selectPage">
- select rownum,a.* from (
- select bto.* from PRESSURE_TASK_ORDER bto
- <where>
- bto.DELETED = 0 and bto.EQUIP_MAIN_TYPE = 200
- <if test="orderNo != null and orderNo != ''">
- AND bto.ORDER_NO LIKE CONCAT('%',#{orderNo},'%')
- </if>
- <if test="unitName != null and unitName != ''">
- AND bto.UNIT_NAME LIKE CONCAT('%',#{unitName},'%')
- </if>
- <if test="checkType != null and checkType != ''">
- AND bto.CHECK_TYPE = #{checkType}
- </if>
- <if test="deptId != null and deptId != ''">
- AND bto.DEPT_ID = #{deptId}
- </if>
- <if test="equipMainType != null and equipMainType != ''">
- AND bto.EQUIP_MAIN_TYPE = #{equipMainType}
- </if>
- <if test="checkDate != null and checkDate.size() >= 2">
- AND bto.CHECK_DATE BETWEEN #{checkDate[0]} AND #{checkDate[1]}
- </if>
- <if test="contractNo != null and contractNo != ''">
- AND bto.CONTRACT_NO LIKE CONCAT('%',#{contractNo},'%')
- </if>
- <if test="taskStatus != null and taskStatus != ''">
- AND bto.TASK_STATUS = #{taskStatus}
- </if>
- <if test="checkUserIds != null and checkUserIds.size() >= 1">
- AND bto.ID in (
- <choose>
- <when test="equipMainType != null and equipMainType == '100'">
- select tu.ORDER_ID from PRESSURE_TASK_ORDER_USER tu
- left join SYSTEM_USERS u on u.ID = tu.USER_ID
- where tu.deleted = 0 and tu.USER_ID IN
- <foreach close=")" collection="checkUserIds" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- <when test="equipMainType != null and equipMainType == '200'">
- select tu.ORDER_ID from pressure2_boiler_task_order_user tu
- left join SYSTEM_USERS u on u.ID = tu.USER_ID
- where tu.deleted = 0 and tu.USER_ID IN
- <foreach close=")" collection="checkUserIds" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- <when test="equipMainType != null and equipMainType == '300'">
- select tu.ORDER_ID from pressure2_pipe_task_order_user tu
- left join SYSTEM_USERS u on u.ID = tu.USER_ID
- where tu.deleted = 0 and tu.USER_ID IN
- <foreach close=")" collection="checkUserIds" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- <otherwise>
- select tu.ORDER_ID from (
- select ORDER_ID, USER_ID from pressure2_boiler_task_order_user where deleted = 0
- union all
- select ORDER_ID, USER_ID from pressure2_pipe_task_order_user where deleted = 0
- ) tu
- left join SYSTEM_USERS u on u.ID = tu.USER_ID
- where tu.USER_ID IN
- <foreach close=")" collection="checkUserIds" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </otherwise>
- </choose>
- )
- </if>
- <if test="submitIds != null and submitIds.size() >= 1">
- AND bto.SUBMIT_ID IN
- <foreach close=")" collection="submitIds" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </if>
- <if test="deptId != null and deptId != ''">
- AND bto.DEPT_ID = #{deptId}
- </if>
- <if test="submitTime != null and submitTime.size() >= 2">
- AND bto.SUBMIT_TIME BETWEEN #{submitTime[0]} AND #{submitTime[1]}
- </if>
- <if test="status != null and status != ''">
- AND bto.STATUS = #{status}
- </if>
- <if test="permissionUserId != null and permissionUserId != ''">
- AND ( bto.MANAGER_ID = #{permissionUserId}
- or bto.ID in (
- <choose>
- <when test="equipMainType != null and equipMainType == '100'">
- select tu.ORDER_ID from PRESSURE_TASK_ORDER_USER tu
- where tu.deleted = 0 and tu.USER_ID = #{permissionUserId}
- </when>
- <when test="equipMainType != null and equipMainType == '200'">
- select tu.ORDER_ID from pressure2_boiler_task_order_user tu
- where tu.deleted = 0 and tu.USER_ID = #{permissionUserId}
- </when>
- <when test="equipMainType != null and equipMainType == '300'">
- select tu.ORDER_ID from pressure2_pipe_task_order_user tu
- where tu.deleted = 0 and tu.USER_ID = #{permissionUserId}
- </when>
- <otherwise>
- select tu.ORDER_ID from (
- select ORDER_ID, USER_ID from pressure2_boiler_task_order_user where deleted = 0
- union all
- select ORDER_ID, USER_ID from pressure2_pipe_task_order_user where deleted = 0
- ) tu
- where tu.USER_ID = #{permissionUserId}
- </otherwise>
- </choose>
- ) )
- </if>
- <if test="permissionDeptIds != null and permissionDeptIds != ''">
- AND ( bto.DEPT_ID in
- <foreach close=")" collection="permissionDeptIds" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- )
- </if>
- <if test="hasPermission != null and hasPermission == false">
- AND 1 = 2
- </if>
- </where>
- order by bto.CREATE_TIME desc
- ) a
- OFFSET ${(pageNo - 1) * pageSize} ROWS FETCH NEXT #{pageSize} ROWS ONLY
- </select>
- <select id="selectPageCount">
- select count(1) from (
- select bto.* from PRESSURE_TASK_ORDER bto
- <where>
- bto.DELETED = 0 and bto.EQUIP_MAIN_TYPE = 200
- <if test="orderNo != null and orderNo != ''">
- AND bto.ORDER_NO LIKE CONCAT('%',#{orderNo},'%')
- </if>
- <if test="unitName != null and unitName != ''">
- AND bto.UNIT_NAME LIKE CONCAT('%',#{unitName},'%')
- </if>
- <if test="checkType != null and checkType != ''">
- AND bto.CHECK_TYPE = #{checkType}
- </if>
- <if test="checkDate != null and checkDate.size() >= 2">
- AND bto.CHECK_DATE BETWEEN #{checkDate[0]} AND #{checkDate[1]}
- </if>
- <if test="contractNo != null and contractNo != ''">
- AND bto.CONTRACT_NO LIKE CONCAT('%',#{contractNo},'%')
- </if>
- <if test="taskStatus != null and taskStatus != ''">
- AND bto.TASK_STATUS = #{taskStatus}
- </if>
- <if test="checkUserIds != null and checkUserIds.size() >= 1">
- AND bto.ID in (select tu.ORDER_ID from pressure2_boiler_task_order_user tu
- where tu.deleted = 0 and tu.USER_ID IN
- <foreach close=")" collection="checkUserIds" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- )
- </if>
- <if test="submitIds != null and submitIds.size() >= 1">
- AND bto.SUBMIT_ID IN
- <foreach close=")" collection="submitIds" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </if>
- <if test="deptId != null and deptId != ''">
- AND bto.DEPT_ID = #{deptId}
- </if>
- <if test="submitTime != null and submitTime.size() >= 2">
- AND bto.SUBMIT_TIME BETWEEN #{submitTime[0]} AND #{submitTime[1]}
- </if>
- <if test="status != null and status != ''">
- AND bto.STATUS = #{status}
- </if>
- <if test="permissionUserId != null and permissionUserId != ''">
- AND ( bto.MANAGER_ID = #{permissionUserId}
- or bto.ID in (select tu.ORDER_ID from pressure2_boiler_task_order_user tu
- where tu.deleted = 0 and tu.USER_ID = #{permissionUserId} ) )
- </if>
- <if test="permissionDeptIds != null and permissionDeptIds != ''">
- AND ( bto.DEPT_ID in
- <foreach close=")" collection="permissionDeptIds" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- )
- </if>
- <if test="hasPermission != null and hasPermission == false">
- AND 1 = 2
- </if>
- </where>
- ) a
- </select>
- <select id="selectItemPage">
- select rownum,a.* from (
- select DISTINCT tt.ID
- ,bto.ID as ORDER_ID
- ,bto.ORDER_NO
- ,eb.EQUIP_CODE
- ,eb.EQUIP_NAME
- ,eb.UNIT_NAME
- ,bto.CHECK_TYPE
- ,bto.DEPT_ID
- ,btoir.TASK_STATUS
- ,bto.CHECK_DATE
- ,bto.MANAGER_ID
- ,tt.MAIN_CHECKER
- ,tt.END_CHECK_DATE
- ,bto.CREATE_TIME
- -- 设备任务
- from PRESSURE2_BOILER_TASK_ORDER_ITEM tt
- left join PRESSURE2_EQUIP_BOILER eb on tt.EQUIP_ID = eb.ID
- left join PRESSURE_TASK_ORDER bto on bto.ID = tt.ORDER_ID and bto.EQUIP_MAIN_TYPE = 200
- left join PRESSURE2_BOILER_TASK_ORDER_ITEM_REPORT btoir on btoir.ORDER_ITEM_ID = tt.ID and btoir.REPORT_TYPE = 100
- <where>tt.DELETED = 0
- AND eb.DELETED = 0
- AND bto.DELETED = 0 and btoir.DELETED = 0
- -- 只显示已认领的任务单
- AND bto.TASK_STATUS = 400
- <if test="isClaim != null">
- <if test="isClaim == 'unclaim'">
- AND (tt.MAIN_CHECKER IS NULL OR tt.MAIN_CHECKER = '')
- </if>
- <if test="isClaim == 'claim'">
- AND (tt.MAIN_CHECKER IS NOT NULL AND tt.MAIN_CHECKER != '')
- </if>
- </if>
- <if test="taskStatusList != null and taskStatusList.size() > 0">
- AND btoir.TASK_STATUS IN
- <foreach collection="taskStatusList" item="taskStatus" open="(" separator="," close=")">
- #{taskStatus}
- </foreach>
- </if>
- <if test="unitCode != null and unitCode != ''">
- AND bto.UNIT_CODE LIKE CONCAT('%',#{unitCode},'%')
- </if>
- <if test="equipCode != null and equipCode != ''">
- AND eb.EQUIP_CODE LIKE CONCAT('%',#{equipCode},'%')
- </if>
- <if test="orderNo != null and orderNo != ''">
- AND bto.ORDER_NO LIKE CONCAT('%',#{orderNo},'%')
- </if>
- <if test="unitName != null and unitName != ''">
- AND bto.UNIT_NAME LIKE CONCAT('%',#{unitName},'%')
- </if>
- <if test="checkType != null and checkType != ''">
- AND bto.CHECK_TYPE = #{checkType}
- </if>
- <if test="deptId != null and deptId != ''">
- AND bto.DEPT_ID = #{deptId}
- </if>
- <if test="orderId != null and orderId != ''">
- AND bto.ID = #{orderId}
- </if>
- <if test="checkDate != null and checkDate.size() >= 2">
- AND bto.CHECK_DATE BETWEEN #{checkDate[0]} AND #{checkDate[1]}
- </if>
- <if test="mainCheckerIds != null and mainCheckerIds.size() > 0">
- AND tt.MAIN_CHECKER IN
- <foreach collection="mainCheckerIds" item="mainCheckerId" open="(" separator="," close=")">
- #{mainCheckerId}
- </foreach>
- </if>
- <if test="managerIds != null and managerIds.size() > 0">
- AND bto.MANAGER_ID IN
- <foreach collection="managerIds" item="managerId" open="(" separator="," close=")">
- #{managerId}
- </foreach>
- </if>
- <if test="checkUserIds != null and checkUserIds.size() > 0">
- AND bto.ID in (select ORDER_ID from PRESSURE2_BOILER_TASK_ORDER_USER where DELETED = 0 and USER_ID IN
- <foreach collection="checkUserIds" item="checkUserId" open="(" separator="," close=")">
- #{checkUserId}
- </foreach>
- )
- </if>
- <if test="permissionUserId != null and permissionUserId != ''">
- AND ( bto.MANAGER_ID = #{permissionUserId}
- or bto.ID in (select tu.ORDER_ID from pressure2_boiler_task_order_user tu
- where tu.deleted = 0 and tu.USER_ID = #{permissionUserId} ) )
- </if>
- <if test="permissionDeptIds != null and permissionDeptIds != ''">
- AND ( bto.DEPT_ID in
- <foreach close=")" collection="permissionDeptIds" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- )
- </if>
- <if test="hasPermission != null and hasPermission == false">
- AND 1 = 2
- </if>
- </where>
- order by bto.CREATE_TIME desc
- ) a
- OFFSET ${(pageNo - 1) * pageSize} ROWS FETCH NEXT #{pageSize} ROWS ONLY
- </select>
- <select id="selectItemPageCount">
- select count(1) from (
- select DISTINCT tt.ID,bto.ORDER_NO,eb.EQUIP_CODE,eb.UNIT_NAME,bto.CHECK_TYPE,btoir.TASK_STATUS
- ,bto.CHECK_DATE,bto.MANAGER_ID,tt.MAIN_CHECKER,tt.END_CHECK_DATE,bto.CREATE_TIME
- -- 设备任务
- from PRESSURE2_BOILER_TASK_ORDER_ITEM tt
- left join PRESSURE2_EQUIP_BOILER eb on tt.EQUIP_ID = eb.ID
- left join PRESSURE_TASK_ORDER bto on bto.ID = tt.ORDER_ID and bto.EQUIP_MAIN_TYPE = 200
- left join PRESSURE2_BOILER_TASK_ORDER_ITEM_REPORT btoir on btoir.ORDER_ITEM_ID = tt.ID and btoir.REPORT_TYPE = 100
- <where>
- tt.DELETED = 0 and eb.DELETED = 0 and bto.DELETED = 0 and btoir.DELETED = 0
- -- 只显示已认领的任务单
- AND bto.TASK_STATUS = 400
- <if test="isClaim != null">
- <if test="isClaim == 'unclaim'">
- AND (tt.MAIN_CHECKER IS NULL OR tt.MAIN_CHECKER = '')
- </if>
- <if test="isClaim == 'claim'">
- AND (tt.MAIN_CHECKER IS NOT NULL AND tt.MAIN_CHECKER != '')
- </if>
- </if>
- <if test="taskStatusList != null and taskStatusList.size() > 0">
- AND btoir.TASK_STATUS IN
- <foreach collection="taskStatusList" item="taskStatus" open="(" separator="," close=")">
- #{taskStatus}
- </foreach>
- </if>
- <if test="unitCode != null and unitCode != ''">
- AND bto.UNIT_CODE LIKE CONCAT('%',#{unitCode},'%')
- </if>
- <if test="equipCode != null and equipCode != ''">
- AND eb.EQUIP_CODE LIKE CONCAT('%',#{equipCode},'%')
- </if>
- <if test="orderNo != null and orderNo != ''">
- AND bto.ORDER_NO LIKE CONCAT('%',#{orderNo},'%')
- </if>
- <if test="unitName != null and unitName != ''">
- AND bto.UNIT_NAME LIKE CONCAT('%',#{unitName},'%')
- </if>
- <if test="checkType != null and checkType != ''">
- AND bto.CHECK_TYPE = #{checkType}
- </if>
- <if test="orderId != null and orderId != ''">
- AND bto.ID = #{orderId}
- </if>
- <if test="checkDate != null and checkDate.size() >= 2">
- AND bto.CHECK_DATE BETWEEN #{checkDate[0]} AND #{checkDate[1]}
- </if>
- <if test="mainCheckerIds != null and mainCheckerIds.size() > 0">
- AND tt.MAIN_CHECKER IN
- <foreach collection="mainCheckerIds" item="mainCheckerId" open="(" separator="," close=")">
- #{mainCheckerId}
- </foreach>
- </if>
- <if test="managerIds != null and managerIds.size() > 0">
- AND bto.MANAGER_ID IN
- <foreach collection="managerIds" item="managerId" open="(" separator="," close=")">
- #{managerId}
- </foreach>
- </if>
- <if test="checkUserIds != null and checkUserIds.size() > 0">
- AND bto.ID in (select ORDER_ID from PRESSURE2_BOILER_TASK_ORDER_USER where DELETED = 0 and USER_ID IN
- <foreach collection="checkUserIds" item="checkUserId" open="(" separator="," close=")">
- #{checkUserId}
- </foreach>
- )
- </if>
- <if test="permissionUserId != null and permissionUserId != ''">
- AND ( bto.MANAGER_ID = #{permissionUserId}
- or bto.ID in (select tu.ORDER_ID from pressure2_boiler_task_order_user tu
- where tu.deleted = 0 and tu.USER_ID = #{permissionUserId} ) )
- </if>
- <if test="permissionDeptIds != null and permissionDeptIds != ''">
- AND ( bto.DEPT_ID in
- <foreach close=")" collection="permissionDeptIds" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- )
- </if>
- <if test="hasPermission != null and hasPermission == false">
- AND 1 = 2
- </if>
- </where>
- ) a
- </select>
- <select id="selectBoilersPage">
- select rownum,a.* from (
- select eb.id,eb.unit_code,eb.unit_name,eb.equip_code,eb.equip_street ,eb.equip_district ,eb.USE_REGISTER_NO,
- eb.CONTACT,eb.CONTACT_PHONE,eb.USE_STATUS as status,
- eb.TONNAGE,eb.PRODUCT_CODE,eb.MAX_CONTINUE_EVAPOR,eb.NEXT_IN_CHECK_DATE,
- eb.NEXT_OUT_CHECK_DATE,eb.NEXT_PRESSURE_CHECK_DATE,eb.BOILER_MODEL,
- eb.FACTORY_CODE
- ,(select a.PLAN_DATE from PRESSURE2_EQUIP_BOILER_SCHEDULING a
- left join PRESSURE2_EQUIP_BOILER_SCHEDULING_ITEM b on a.ID = b.SCHEDULING_ID
- where b.equip_id = eb.id and a.DELETED = 0 and b.DELETED = 0 and a.type = 100 limit 1) plan_in_check_date
- ,(select a.PLAN_DATE from PRESSURE2_EQUIP_BOILER_SCHEDULING a
- left join PRESSURE2_EQUIP_BOILER_SCHEDULING_ITEM b on a.ID = b.SCHEDULING_ID
- where b.equip_id = eb.id and a.DELETED = 0 and b.DELETED = 0 and a.type = 200 limit 1) plan_out_check_date
- ,(select a.PLAN_DATE from PRESSURE2_EQUIP_BOILER_SCHEDULING a
- left join PRESSURE2_EQUIP_BOILER_SCHEDULING_ITEM b on a.ID = b.SCHEDULING_ID
- where b.equip_id = eb.id and a.DELETED = 0 and b.DELETED = 0 and a.type = 300 limit 1) plan_pre_check_date
- from PRESSURE2_EQUIP_BOILER eb
- <where>
- eb.deleted = 0
- <if test="unitName != null and unitName != ''">
- AND eb.unit_name LIKE CONCAT('%',#{unitName},'%')
- </if>
- <if test="unitCode != null">
- and eb.unit_code = #{unitCode}
- </if>
- <if test="unitAddress != null and unitAddress != ''">
- AND eb.unit_address LIKE CONCAT('%',#{unitAddress},'%')
- </if>
- <if test="equipCode != null and equipCode != ''">
- AND eb.equip_code LIKE CONCAT('%',#{equipCode},'%')
- </if>
- <if test="deptId != null and deptId != ''">
- AND eb.RELATED_DEPARTMENT = #{deptId}
- </if>
- <if test="equipStreet != null and equipStreet.size() > 0">
- AND eb.equip_street IN
- <foreach close=")" collection="equipStreet" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </if>
- <if test="equipDistrict != null and equipDistrict.size() > 0">
- AND eb.equip_district IN
- <foreach close=")" collection="equipDistrict" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </if>
- <if test="nextDate != null and nextDate.size() >= 2">
- AND (
- (eb.NEXT_IN_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
- OR (eb.NEXT_OUT_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
- OR (eb.NEXT_PRESSURE_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
- )
- </if>
- <if test="typeList != null and typeList.size() > 0">
- AND eb.type IN
- <foreach close=")" collection="typeList" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </if>
- <if test="useStatus != null and useStatus.size() > 0">
- AND eb.USE_STATUS IN
- <foreach close=")" collection="useStatus" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </if>
- <if test="orderId != null and orderId != ''">
- AND eb.ID IN (
- select EQUIP_ID from PRESSURE2_BOILER_TASK_ORDER_ITEM where ORDER_ID = #{orderId} and DELETED = 0
- )
- </if>
- <if test="notOrderId != null and notOrderId != ''">
- AND eb.ID NOT IN (
- select EQUIP_ID from PRESSURE2_BOILER_TASK_ORDER_ITEM where ORDER_ID = #{notOrderId} and DELETED = 0
- )
- </if>
- </where>
- ) a
- OFFSET ${(pageNo - 1) * pageSize} ROWS FETCH NEXT #{pageSize} ROWS ONLY
- </select>
- <select id="selectBoilersPageCount">
- select count(1) from (
- select eb.id,eb.unit_code,eb.unit_name,eb.equip_code,eb.equip_street ,eb.equip_district ,eb.USE_REGISTER_NO,
- eb.CONTACT,eb.CONTACT_PHONE,eb.STATUS,
- eb.TONNAGE,eb.PRODUCT_CODE,eb.MAX_CONTINUE_EVAPOR,eb.NEXT_IN_CHECK_DATE,
- eb.NEXT_OUT_CHECK_DATE,eb.NEXT_PRESSURE_CHECK_DATE,eb.BOILER_MODEL
- ,(select a.PLAN_DATE from PRESSURE2_EQUIP_BOILER_SCHEDULING a
- left join PRESSURE2_EQUIP_BOILER_SCHEDULING_ITEM b on a.ID = b.SCHEDULING_ID
- where b.equip_id = eb.id and a.DELETED = 0 and b.DELETED = 0 and a.type = 100 limit 1) plan_in_check_date
- ,(select a.PLAN_DATE from PRESSURE2_EQUIP_BOILER_SCHEDULING a
- left join PRESSURE2_EQUIP_BOILER_SCHEDULING_ITEM b on a.ID = b.SCHEDULING_ID
- where b.equip_id = eb.id and a.DELETED = 0 and b.DELETED = 0 and a.type = 200 limit 1) plan_out_check_date
- ,(select a.PLAN_DATE from PRESSURE2_EQUIP_BOILER_SCHEDULING a
- left join PRESSURE2_EQUIP_BOILER_SCHEDULING_ITEM b on a.ID = b.SCHEDULING_ID
- where b.equip_id = eb.id and a.DELETED = 0 and b.DELETED = 0 and a.type = 300 limit 1) plan_pre_check_date
- from PRESSURE2_EQUIP_BOILER eb
- <where>
- eb.deleted = 0
- <if test="unitName != null and unitName != ''">
- AND eb.unit_name LIKE CONCAT('%',#{unitName},'%')
- </if>
- <if test="unitCode != null">
- and eb.unit_code = #{unitCode}
- </if>
- <if test="unitAddress != null and unitAddress != ''">
- AND eb.unit_address LIKE CONCAT('%',#{unitAddress},'%')
- </if>
- <if test="equipCode != null and equipCode != ''">
- AND eb.equip_code LIKE CONCAT('%',#{equipCode},'%')
- </if>
- <if test="deptId != null and deptId != ''">
- AND eb.RELATED_DEPARTMENT = #{deptId}
- </if>
- <if test="useStatus != null and useStatus.size() > 0">
- AND eb.USE_STATUS IN
- <foreach close=")" collection="useStatus" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </if>
- <if test="equipStreet != null and equipStreet.size() > 0">
- AND eb.equip_street IN
- <foreach close=")" collection="equipStreet" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </if>
- <if test="equipDistrict != null and equipDistrict.size() > 0">
- AND eb.equip_district IN
- <foreach close=")" collection="equipDistrict" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </if>
- <if test="nextDate != null and nextDate.size() >= 2">
- AND (
- (eb.NEXT_IN_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
- OR (eb.NEXT_OUT_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
- OR (eb.NEXT_PRESSURE_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
- )
- </if>
- <if test="typeList != null and typeList.size() > 0">
- AND eb.type IN
- <foreach close=")" collection="typeList" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </if>
- <if test="orderId != null and orderId != ''">
- AND eb.ID IN (
- select EQUIP_ID from PRESSURE2_BOILER_TASK_ORDER_ITEM where ORDER_ID = #{orderId} and DELETED = 0
- )
- </if>
- <if test="notOrderId != null and notOrderId != ''">
- AND eb.ID NOT IN (
- select EQUIP_ID from PRESSURE2_BOILER_TASK_ORDER_ITEM where ORDER_ID = #{notOrderId} and DELETED = 0
- )
- </if>
- </where>
- ) a
- </select>
- </mapper>
|