| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538 |
- <?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.equippipescheduling.EquipPipeSchedulingMapper">
- <!--
- 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
- 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
- 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
- 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
- -->
- <select id="selectPlanPage">
- select rownum,a.* from (
- select eb.EQUIP_DISTRICT,eb.EQUIP_STREET,eb.UNIT_CODE,eb.UNIT_NAME
- ,eb.PIPE_ADDRESS,eb.CONTACT,eb.CONTACT_PHONE,eb.UNIT_ID
- ,min(eb.id) as id
- ,LISTAGG(CASE WHEN eb.NEXT_LEGAL_CHECK_DATE IS NOT NULL
- AND eb.HAS_LEGAL_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_LEGAL_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN eb.id ELSE NULL END, ',' ON OVERFLOW TRUNCATE) AS legal_equip_ids
- ,LISTAGG(CASE WHEN eb.NEXT_YEAR_CHECK_DATE IS NOT NULL
- AND eb.HAS_LEGAL_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_YEAR_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN eb.id ELSE NULL END, ',' ON OVERFLOW TRUNCATE) AS year_equip_ids
- ,SUM(CASE WHEN eb.NEXT_LEGAL_CHECK_DATE IS NOT NULL
- AND eb.HAS_LEGAL_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_LEGAL_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN 1 ELSE 0 END) AS count_legal
- ,SUM(CASE WHEN eb.NEXT_YEAR_CHECK_DATE IS NOT NULL
- AND eb.HAS_YEAR_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_YEAR_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN 1 ELSE 0 END) AS count_year
- ,MIN(CASE WHEN eb.NEXT_LEGAL_CHECK_DATE IS NOT NULL
- AND eb.HAS_LEGAL_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_LEGAL_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN eb.NEXT_LEGAL_CHECK_DATE ELSE NULL END
- ) AS NEXT_LEGAL_CHECK_DATE
- ,MIN(CASE WHEN eb.NEXT_YEAR_CHECK_DATE IS NOT NULL
- AND eb.HAS_YEAR_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_YEAR_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN eb.NEXT_YEAR_CHECK_DATE ELSE NULL END
- ) AS NEXT_YEAR_CHECK_DATE
- ,MIN(COALESCE(
- CASE WHEN eb.NEXT_LEGAL_CHECK_DATE IS NOT NULL AND eb.HAS_LEGAL_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_LEGAL_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN eb.NEXT_LEGAL_CHECK_DATE ELSE NULL END,
- CASE WHEN eb.NEXT_YEAR_CHECK_DATE IS NOT NULL AND eb.HAS_YEAR_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_YEAR_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN eb.NEXT_YEAR_CHECK_DATE ELSE NULL END
- )) AS unified_check_date
- from PRESSURE2_EQUIP_PIPE eb
- <where>
- eb.deleted = 0
- <if test="unitName != null and unitName != ''">
- AND eb.UNIT_NAME LIKE CONCAT('%',#{unitName},'%')
- </if>
- <if test="pipeAddress != null and pipeAddress != ''">
- AND eb.PIPE_ADDRESS LIKE CONCAT('%',#{pipeAddress},'%')
- </if>
- <if test="relateDepartment != null and relateDepartment != ''">
- AND eb.RELATION_DEPT = #{relateDepartment}
- </if>
- <if test="projectNo != null and projectNo != ''">
- AND eb.PROJECT_NO LIKE CONCAT('%',#{projectNo},'%')
- </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_LEGAL_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
- OR (eb.NEXT_YEAR_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
- )
- </if>
- <if test="typeList != null and typeList.size() > 0">
- AND eb.PIPE_CATEGORY IN
- <foreach close=")" collection="typeList" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </if>
- </where>
- group by eb.EQUIP_DISTRICT,eb.EQUIP_STREET,eb.UNIT_CODE,eb.PIPE_ADDRESS,
- eb.CONTACT,eb.CONTACT_PHONE
- order by unified_check_date NULLS LAST,eb.EQUIP_DISTRICT,eb.EQUIP_STREET
- ) a
- WHERE a.count_legal > 0 OR a.count_year > 0
- OFFSET ${(pageNo - 1) * pageSize} ROWS FETCH NEXT #{pageSize} ROWS ONLY
- </select>
- <select id="selectPlanPageCount">
- select count(*) from (
- select eb.EQUIP_DISTRICT,eb.EQUIP_STREET,eb.UNIT_CODE,eb.UNIT_NAME
- ,eb.PIPE_ADDRESS,eb.CONTACT,eb.CONTACT_PHONE,eb.UNIT_ID
- ,min(eb.id) as id
- ,LISTAGG(CASE WHEN eb.NEXT_LEGAL_CHECK_DATE IS NOT NULL
- AND eb.HAS_LEGAL_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_LEGAL_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN eb.id ELSE NULL END, ',' ON OVERFLOW TRUNCATE) AS legal_equip_ids
- ,LISTAGG(CASE WHEN eb.NEXT_YEAR_CHECK_DATE IS NOT NULL
- AND eb.HAS_YEAR_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_YEAR_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN eb.id ELSE NULL END, ',' ON OVERFLOW TRUNCATE) AS year_equip_ids
- ,SUM(CASE WHEN eb.NEXT_LEGAL_CHECK_DATE IS NOT NULL
- AND eb.HAS_LEGAL_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_LEGAL_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN 1 ELSE 0 END) AS count_legal
- ,SUM(CASE WHEN eb.NEXT_YEAR_CHECK_DATE IS NOT NULL
- AND eb.HAS_YEAR_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_YEAR_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN 1 ELSE 0 END) AS count_year
- ,MIN(CASE WHEN eb.NEXT_LEGAL_CHECK_DATE IS NOT NULL
- AND eb.HAS_LEGAL_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_LEGAL_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN eb.NEXT_LEGAL_CHECK_DATE ELSE NULL END
- ) AS NEXT_LEGAL_CHECK_DATE
- ,MIN(CASE WHEN eb.NEXT_YEAR_CHECK_DATE IS NOT NULL
- AND eb.HAS_YEAR_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_YEAR_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN eb.NEXT_YEAR_CHECK_DATE ELSE NULL END
- ) AS NEXT_YEAR_CHECK_DATE
- ,MIN(COALESCE(
- CASE WHEN eb.NEXT_LEGAL_CHECK_DATE IS NOT NULL AND eb.HAS_LEGAL_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_LEGAL_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN eb.NEXT_LEGAL_CHECK_DATE ELSE NULL END,
- CASE WHEN eb.NEXT_YEAR_CHECK_DATE IS NOT NULL AND eb.HAS_YEAR_SCHEDULING = 0
- <if test="nextDate != null and nextDate.size()>= 2">
- AND eb.NEXT_YEAR_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]}
- </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>
- THEN eb.NEXT_YEAR_CHECK_DATE ELSE NULL END
- )) AS unified_check_date
- from PRESSURE2_EQUIP_PIPE eb
- <where>
- eb.deleted = 0
- <if test="unitName != null and unitName != ''">
- AND eb.UNIT_NAME LIKE CONCAT('%',#{unitName},'%')
- </if>
- <if test="pipeAddress != null and pipeAddress != ''">
- AND eb.PIPE_ADDRESS LIKE CONCAT('%',#{pipeAddress},'%')
- </if>
- <if test="relateDepartment != null and relateDepartment != ''">
- AND eb.RELATION_DEPT = #{relateDepartment}
- </if>
- <if test="projectNo != null and projectNo != ''">
- AND eb.PROJECT_NO LIKE CONCAT('%',#{projectNo},'%')
- </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_LEGAL_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
- OR (eb.NEXT_YEAR_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
- )
- </if>
- <if test="typeList != null and typeList.size() > 0">
- AND eb.PIPE_CATEGORY IN
- <foreach close=")" collection="typeList" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </if>
- </where>
- group by eb.EQUIP_DISTRICT,eb.EQUIP_STREET,eb.UNIT_CODE,eb.PIPE_ADDRESS,
- eb.CONTACT,eb.CONTACT_PHONE
- ORDER BY unified_check_date NULLS LAST,eb.EQUIP_DISTRICT,eb.EQUIP_STREET
- ) a
- WHERE a.count_legal > 0 OR a.count_year > 0
- </select>
- <select id="selectPlanPageGroupProject">
- select ped.ID,ped.EQUIP_PIPE_ID,ped.PIPE_NO,ped.PIPE_NAME,ped.PIPE_REG_CODE,ped.PIPE_LENGTH,
- pe.PROJECT_NO,pe.PROJECT_NAME,pe.CONTACT,pe.CONTACT_PHONE,ped.HAS_LEGAL_SCHEDULING,ped.HAS_YEAR_SCHEDULING,
- pe.NEXT_LEGAL_CHECK_DATE,pe.NEXT_YEAR_CHECK_DATE,
- ped.NEXT_LEGAL_CHECK_DATE as NEXT_LEGAL_CHECK_DATE_DETAIL,
- ped.NEXT_YEAR_CHECK_DATE as NEXT_YEAR_CHECK_DATE_DETAIL,
- pe.UNIT_ID
- ,(select a.PLAN_DATE from PRESSURE2_EQUIP_PIPE_SCHEDULING a
- left join PRESSURE2_EQUIP_PIPE_SCHEDULING_ITEM_DETAIL b on a.ID = b.SCHEDULING_ID
- where b.equip_detail_id = ped.id and a.DELETED = 0 and b.DELETED = 0 and a.type = 100 limit 1) plan_legal_check_date
- ,(select a.PLAN_DATE from PRESSURE2_EQUIP_PIPE_SCHEDULING a
- left join PRESSURE2_EQUIP_PIPE_SCHEDULING_ITEM_DETAIL b on a.ID = b.SCHEDULING_ID
- where b.equip_detail_id = ped.id and a.DELETED = 0 and b.DELETED = 0 and a.type = 200 limit 1) plan_year_check_date
- from PRESSURE2_EQUIP_PIPE_DETAIL ped
- left join PRESSURE2_EQUIP_PIPE pe on ped.EQUIP_PIPE_ID = pe.ID
- where pe.DELETED = 0 and ped.DELETED = 0
- and (ped.HAS_LEGAL_SCHEDULING = 0 or ped.HAS_YEAR_SCHEDULING = 0)
- and ped.EQUIP_PIPE_ID in
- <foreach close=")" collection="ids" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </select>
- <select id="selectPlanCalendar">
- select a.ID task_id,a.TYPE check_type,b.unit_code,b.unit_name,b.unit_address,a.plan_date,count(distinct c.ID) equip_count,
- b.equip_district,b.equip_street,a.source,FIRST_VALUE(b.lng) lng,FIRST_VALUE(b.lat) lat,
- e.id APPOINTMENT_ID,f.id ACCEPT_ORDER_ID,f.STATUS accept_status, g.TASK_STATUS
- from PRESSURE2_EQUIP_PIPE_SCHEDULING a
- inner join PRESSURE2_EQUIP_PIPE_SCHEDULING_ITEM c on c.SCHEDULING_ID = a.ID and c.DELETED = 0
- inner join PRESSURE2_EQUIP_PIPE b on b.ID = c.equip_id and b.DELETED = 0
- inner join PRESSURE2_EQUIP_PIPE_SCHEDULING_USER d on d.SCHEDULING_ID = a.ID and d.DELETED = 0
- left join PRESSURE_APPOINTMENT_CONFIRM_ORDER e on e.SCHEDULING_ID = a.ID
- left join PRESSURE_ACCEPT_ORDER f on f.APPOINTMENT_ID = e.ID
- left join PRESSURE_Task_ORDER g on g.ACCEPT_ORDER_ID = f.ID
- <where>
- a.DELETED = 0
- <if test="planDate != null and planDate.size() >= 2">
- and a.plan_date between #{planDate[0]} and #{planDate[1]}
- </if>
- <if test="userId != null and userId != ''">
- and a.CREATOR = #{userId}
- </if>
- <if test="relateDepartment != null and relateDepartment != ''">
- and b.RELATION_DEPT = #{relateDepartment}
- </if>
- </where>
- group by b.unit_code,a.plan_date,a.type,a.ID
- order by b.unit_code
- </select>
- <select id="selectPlanPipesPage">
- select rownum,a.* from (
- select id,unit_code,unit_name,equip_street ,equip_district ,CONTACT,CONTACT_PHONE,
- NEXT_LEGAL_CHECK_DATE,NEXT_YEAR_CHECK_DATE,project_no,project_name,pipe_category
- ,(select a.PLAN_DATE from PRESSURE2_EQUIP_PIPE_SCHEDULING a
- left join PRESSURE2_EQUIP_PIPE_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 order by a.CREATE_TIME DESC limit 1) plan_legal_check_date
- ,(select a.PLAN_DATE from PRESSURE2_EQUIP_PIPE_SCHEDULING a
- left join PRESSURE2_EQUIP_PIPE_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 order by a.CREATE_TIME DESC limit 1) plan_year_check_date
- from PRESSURE2_EQUIP_PIPE 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="pipeAddress != null and pipeAddress != ''">
- AND eb.PIPE_ADDRESS LIKE CONCAT('%',#{pipeAddress},'%')
- </if>
- <if test="relateDepartment != null and relateDepartment != ''">
- AND eb.RELATION_DEPT = #{relateDepartment}
- </if>
- <if test="projectNo != null and projectNo != ''">
- AND eb.PROJECT_NO LIKE CONCAT('%',#{projectNo},'%')
- </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_LEGAL_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
- OR (eb.NEXT_YEAR_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
- )
- </if>
- <if test="typeList != null and typeList.size() > 0">
- AND eb.PIPE_CATEGORY 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="equipIds != null and equipIds != ''">
- AND eb.id IN
- <foreach
- collection="equipIds"
- item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="taskId != null and taskId != ''">
- AND eb.ID IN (
- select EQUIP_ID from PRESSURE2_EQUIP_PIPE_SCHEDULING_item where SCHEDULING_ID = #{taskId} and DELETED = 0
- )
- </if>
- <if test="notTaskId != null and notTaskId != ''">
- AND eb.ID NOT IN (
- select EQUIP_ID from PRESSURE2_EQUIP_PIPE_SCHEDULING_item where SCHEDULING_ID = #{notTaskId} and DELETED = 0
- )
- </if>
- </where>
- ) a
- OFFSET ${(pageNo - 1) * pageSize} ROWS FETCH NEXT #{pageSize} ROWS ONLY
- </select>
- <select id="selectPlanPipesPageCount">
- select count(*) from (
- select id,unit_code,unit_name,equip_street ,equip_district ,CONTACT,CONTACT_PHONE,
- NEXT_LEGAL_CHECK_DATE,NEXT_YEAR_CHECK_DATE
- ,(select a.PLAN_DATE from PRESSURE2_EQUIP_PIPE_SCHEDULING a
- left join PRESSURE2_EQUIP_PIPE_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 order by a.CREATE_TIME limit 1) plan_legal_check_date
- ,(select a.PLAN_DATE from PRESSURE2_EQUIP_PIPE_SCHEDULING a
- left join PRESSURE2_EQUIP_PIPE_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 order by a.CREATE_TIME limit 1) plan_year_check_date
- from PRESSURE2_EQUIP_PIPE 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="pipeAddress != null and pipeAddress != ''">
- AND eb.PIPE_ADDRESS LIKE CONCAT('%',#{pipeAddress},'%')
- </if>
- <if test="relateDepartment != null and relateDepartment != ''">
- AND eb.RELATION_DEPT = #{relateDepartment}
- </if>
- <if test="projectNo != null and projectNo != ''">
- AND eb.PROJECT_NO LIKE CONCAT('%',#{projectNo},'%')
- </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_LEGAL_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
- OR (eb.NEXT_YEAR_CHECK_DATE BETWEEN #{nextDate[0]} AND #{nextDate[1]})
- )
- </if>
- <if test="typeList != null and typeList.size() > 0">
- AND eb.PIPE_CATEGORY 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="taskId != null and taskId != ''">
- AND eb.ID IN (
- select EQUIP_ID from PRESSURE2_EQUIP_PIPE_SCHEDULING_item where SCHEDULING_ID = #{taskId} and DELETED = 0
- )
- </if>
- <if test="notTaskId != null and notTaskId != ''">
- AND eb.ID NOT IN (
- select EQUIP_ID from PRESSURE2_EQUIP_PIPE_SCHEDULING_item where SCHEDULING_ID = #{notTaskId} and DELETED = 0
- )
- </if>
- <if test="equipIds != null and equipIds != ''">
- AND eb.id IN
- <foreach
- collection="equipIds"
- item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- ) a
- </select>
- </mapper>
|