| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376 |
- <?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.com.goldenwater.dcproj.dao.DcPageOfficeLyzzReportDao">
- <!-- 根据节点获取 派出督查组及人员情况-->
- <select id="getGroupAndPerson" resultType="java.util.HashMap">
- select
- <choose>
- <when test="id.length()==6">
- substr(t.id,1,6)
- </when>
- <when test="id.length()==9">
- substr(t.id,1,9)
- </when>
- <otherwise>
- t.id
- </otherwise>
- </choose> id,
- (select pnm from BIS_INSP_ALL q where q.id=
- <choose>
- <when test="id.length()==6">
- substr(t.id,1,6)
- </when>
- <when test="id.length()==9">
- substr(t.id,1,9)
- </when>
- <otherwise>
- t.id
- </otherwise>
- </choose>
- ) pnm,
- (SELECT COUNT(DISTINCT ID) FROM BIS_INSP_ALL_RLATION WHERE ID like CONCAT(#{id}, '%') AND LENGTH(ID)=12) dcz_con,
- (SELECT COUNT(DISTINCT PERSID) FROM BIS_INSP_ALL_RLATION WHERE ID like CONCAT(#{id}, '%')) ry_con,
- count(distinct (case when instr(t1.ADM_DUTY,'局长')>0 then t1.id else null end )) jz_con,
- count(distinct (case when instr(t1.ADM_DUTY,'处长')>0 then t1.id else null end )) cz_con
- from
- (SELECT *
- FROM BIS_INSP_ALL
- <where>
- <choose>
- <when test="id.length()==6">
- and substr(id,1,6) = #{id}
- </when>
- <when test="id.length()==9">
- and substr(id,1,9) = #{id}
- </when>
- <otherwise>
- and id = #{id}
- </otherwise>
- </choose>
- </where>
- ) T
- LEFT JOIN
- (
- SELECT
- Q.ID,Q1.PERS_NAME,Q1.ORG_NM,Q1.DPPOST,Q.PERTYPE,Q1.ADM_DUTY
- FROM BIS_INSP_ALL_RLATION Q
- INNER JOIN BIS_INSP_ALL_RLATION_PERS Q1 ON Q.PERSID=Q1.GUID
- WHERE LENGTH(Q.ID)=12
- ) T1 ON T.ID = T1.ID
- <choose>
- <when test="id.length()==6">
- GROUP BY SUBSTR(T.ID,1,6)
- </when>
- <when test="id.length()==9">
- GROUP BY SUBSTR(T.ID,1,9)
- </when>
- <otherwise>
- GROUP BY T.ID
- </otherwise>
- </choose>
- </select>
- <!-- 根据节点获取 派出督查组及人员情况(未使用)-->
- <select id="getGroupAndPerson1" resultType="java.util.HashMap">
- SELECT
- count(DISTINCT ID) jianchazu,
- count(DISTINCT GUID) zong_renyuan,
- count(DISTINCT (case when instr(ADM_DUTY,'局长')>0 then id else null end )) jz_con,
- count(DISTINCT (case when instr(ADM_DUTY,'处长')>0 then id else null end )) cz_con
- FROM
- (
- SELECT a.ID, p.GUID, p.ADM_DUTY
- FROM
- (
- SELECT ID FROM BIS_INSP_ALL WHERE ID LIKE CONCAT( #{id}, '%') AND lengthb(ID) = 12
- ) a
- LEFT JOIN BIS_INSP_ALL_RLATION r ON a.ID = r.ID
- LEFT JOIN BIS_INSP_ALL_RLATION_PERS p ON r.PERSID = p.GUID
- )
- </select>
- <!--督查水库数量及分布情况-->
- <select id="getRsvrDis" resultType="java.util.HashMap">
- select
- ifnull(count(1),0) con,
- ifnull(sum(case t.Eng_Scal when '4' then 1 else 0 end ),0) xiao1,
- ifnull(sum(case t.Eng_Scal when '5' then 1 else 0 end ),0) xiao2,
- ifnull(count(distinct substr(t.ad_code,1,2)),0) sheng1,
- ifnull(count(distinct substr(t.ad_code,1,4)),0) shi1,
- ifnull(count(distinct substr(t.ad_code,1,6)),0) xian1
- from BIS_INSP_RSVR_RGSTR t
- left join BIS_INSP_ALL_OBJ t1 on t.obj_id=t1.obj_id
- where t.eng_scal in ('4', '5')
- and t.STATE = '2'
- and length(t1.id)=12
- <choose>
- <when test="id.length()==6">
- and substr(t1.id,1,6) = #{id}
- </when>
- <when test="id.length()==9">
- and substr(t1.id,1,9) = #{id}
- </when>
- <otherwise>
- and t1.id = #{id}
- </otherwise>
- </choose>
- </select>
- <!--检查水库总体情况-->
- <select id="getRsvrChk" resultType="java.util.HashMap">
- select
- ifnull(sum(case when c.SAFE_COMMENT = '1' then 1 else 0 end),0) normal,
- ifnull(sum(case when c.SAFE_COMMENT = '2' then 1 else 0 end),0) danger,
- ifnull(sum(case when c.SAFE_COMMENT = '3' then 1 else 0 end),0) unable
- from
- (select obj_id, rgstr_id, eng_scal, ad_code, STATE from BIS_INSP_RSVR_RGSTR) a
- left join
- BIS_INSP_ALL_OBJ b on a.obj_id = b.obj_id
- left join
- BIS_INSP_SAFE_EXT_MANAGE c on a.rgstr_id = c.rgstr_id
- where
- a.eng_scal in ('4', '5')
- and a.STATE = '2'
- and length(b.id) = 12
- <choose>
- <when test="id.length()==6">
- and substr(b.id,1,6) = #{id}
- </when>
- <when test="id.length()==9">
- and substr(b.id,1,9) = #{id}
- </when>
- <otherwise>
- and b.id = #{id}
- </otherwise>
- </choose>
- </select>
- <!--效益发挥情况-->
- <select id="getRsvrBenef" resultType="java.util.HashMap">
- select
- sum(case when c.IF_EFFECTIVE = '1' then 1 else 0 end) benefit,
- sum(case when c.IF_EFFECTIVE = '2' then 1 else 0 end) nbenefit,
- sum(ifnull(c.WSFDWS, 0)) WSFDWS,
- sum(ifnull(c.HAS_SET_MAIN_FL, 0)) HASSETMAINFL
- from
- (select obj_id, rgstr_id, eng_scal, ad_code, STATE from BIS_INSP_RSVR_RGSTR) a
- left join
- BIS_INSP_ALL_OBJ b on a.obj_id = b.obj_id
- left join
- BIS_INSP_RSVR_BENEFITS c on a.rgstr_id = c.rgstr_id
- where
- a.eng_scal in ('4', '5')
- and a.STATE = '2'
- and length(b.id) = 12
- <choose>
- <when test="id.length()==6">
- and substr(b.id,1,6) = #{id}
- </when>
- <when test="id.length()==9">
- and substr(b.id,1,9) = #{id}
- </when>
- <otherwise>
- and b.id = #{id}
- </otherwise>
- </choose>
- </select>
- <!--“三个责任人”落实履职情况-->
- <select id="getRsvrZrr" resultType="java.util.HashMap">
- select
- ifnull(count(distinct (case when e.POOR_COUNTRY='1' then substr(a.ad_code,1,6) else null end)),0) POORCOUNTRY,
- ifnull(count(1),0) con,
- sum(case when d.Has_Wiun_Wao_Leg_Pers='1' then 1 else 0 end) Has_Wiun_Wao_Leg_Pers,
- sum(case when d.WIUN_WAO_LEG_PERS_TRAIN='1' then 1 else 0 end) Has_Wiun_Wao_Leg_Pers_TRAIN,
- sum(case when d.Wiun_Wao_Leg_Pers_Resu='1' then 1 else 0 end) Wiun_Wao_Leg_Pers_Resu1,
- sum(case when d.Wiun_Wao_Leg_Pers_Resu='2' then 1 else 0 end) Wiun_Wao_Leg_Pers_Resu2,
- sum(case when d.Wiun_Wao_Leg_Pers_Resu='3' then 1 else 0 end) Wiun_Wao_Leg_Pers_Resu3,
- sum(case when d.Has_Tech_Pers='1' then 1 else 0 end) Has_Tech_Pers,
- sum(case when d.Has_Tech_Pers='2' then 1 else 0 end) Has_NO_Tech_Pers,
- sum(case when d.TECH_PERS_TRAIN='1' then 1 else 0 end) Has_Tech_Pers_TRAIN,
- sum(case when d.Tech_Pers_Resu='1' then 1 else 0 end) Tech_Pers_Resu1,
- sum(case when d.Tech_Pers_Resu='2' then 1 else 0 end) Tech_Pers_Resu2,
- sum(case when d.Tech_Pers_Resu='3' then 1 else 0 end) Tech_Pers_Resu3,
- sum(case when d.Has_Patrol_Pers='1' then 1 else 0 end) Has_Patrol_Pers,
- sum(case when d.PATROL_PERS_TRAIN='1' then 1 else 0 end) Has_Patrol_Pers_TRAIN,
- sum(case when d.Patrol_Pers_Resu='1' then 1 else 0 end) Patrol_Pers_Resu1,
- sum(case when d.Patrol_Pers_Resu='2' then 1 else 0 end) Patrol_Pers_Resu2,
- sum(case when d.Patrol_Pers_Resu='3' then 1 else 0 end) Patrol_Pers_Resu3,
- sum(case when d.HAS_ATTEND_TRAIN='1' then 1 else 0 end) HAS_ATTEND_TRAIN,
- <!--“三个重点环节”建设落实情况-->
- sum(case when c.RAIN_FORC='1' then 1 else 0 end) RAIN_FORC1,
- sum(case when c.RAIN_FORC='2' and c.RAIN_FORC_NOTE = '1' then 1 else 0 end) RAIN_FORC2,
- sum(case when c.RAIN_FORC='2' and c.RAIN_FORC_NOTE = '2' then 1 else 0 end) RAIN_FORC3,
- sum(case when c.SCH_PLAN_SAME_EXTA='1' then 1 else 0 end) SCH_PLAN_SAME_EXTA1,
- sum(case when c.SCH_PLAN_SAME_EXTA='2' then 1 else 0 end) SCH_PLAN_SAME_EXTA2,
- sum(case when c.SCH_PLAN_SAME_APPR='1' then 1 else 0 end) SCH_PLAN_SAME_APPR1,
- sum(case when c.SCH_PLAN_SAME_APPR='2' then 1 else 0 end) SCH_PLAN_SAME_APPR2,
- sum(case when c.SCH_PLAN_SAME_SPEED='1' then 1 else 0 end) SCH_PLAN_SAME_SPEED1,
- sum(case when c.SCH_PLAN_SAME_SPEED='2' then 1 else 0 end) SCH_PLAN_SAME_SPEED2,
- sum(case when c.SCH_PLAN_SAME_SPEED='3' then 1 else 0 end) SCH_PLAN_SAME_SPEED3,
- sum(case when c.EMER_PLAN_SAME_EXTA='1' then 1 else 0 end) EMER_PLAN_SAME_EXTA1,
- sum(case when c.EMER_PLAN_SAME_EXTA='2' then 1 else 0 end) EMER_PLAN_SAME_EXTA2,
- sum(case when c.EMER_PLAN_SAME_APPR='1' then 1 else 0 end) EMER_PLAN_SAME_APPR1,
- sum(case when c.EMER_PLAN_SAME_APPR='2' then 1 else 0 end) EMER_PLAN_SAME_APPR2,
- sum(case when c.EMER_PLAN_SAME_EME='1' then 1 else 0 end) EMER_PLAN_SAME_EME1,
- sum(case when c.EMER_PLAN_SAME_EME='2' then 1 else 0 end) EMER_PLAN_SAME_EME2,
- sum(case when c.EMER_PLAN_SAME_SPEED='1' then 1 else 0 end) EMER_PLAN_SAME_SPEED1,
- sum(case when c.EMER_PLAN_SAME_SPEED='2' then 1 else 0 end) EMER_PLAN_SAME_SPEED2,
- sum(case when c.EMER_PLAN_SAME_SPEED='3' then 1 else 0 end) EMER_PLAN_SAME_SPEED3,
- <!--运行管理情况-->
- sum(case when e.IF_FSLTDZ_RUN='1' then 1 else 0 end) IF_FSLTDZ_RUN1,
- sum(case when e.IF_FSLTDZ_RUN='2' then 1 else 0 end) IF_FSLTDZ_RUN2,
- sum(case when e.IF_FSLTDZ_NO='1' then 1 else 0 end) IF_FSLTDZ_NO1,
- sum(case when e.IF_FSLTDZ_NO='2' then 1 else 0 end) IF_FSLTDZ_NO2,
- sum(case when e.HAS_WD_EMNIC='2' then 1 else 0 end) HAS_WD_EMNIC2,
- sum(case when e.IF_DAM_WARN_LOGO='2' then 1 else 0 end) IF_DAM_WARN_LOGO2,
- sum(case when e.IF_MANAGE_REG_REL='1' then 1 else 0 end) IF_MANAGE_REG_REL1,
- sum(case when e.IF_MANAGE_REG_REL='2' then 1 else 0 end) IF_MANAGE_REG_REL2,
- sum(case when e.IF_MANAGE_REG='2' then 1 else 0 end) IF_MANAGE_REG2,
- sum(case when e.IF_DAM_WARN_LOGO='1' then 1 else 0 end) IF_DAM_WARN_LOGO1,
- <!--工程实体情况-->
- sum(case when f.DISK_RUN_INFO='1' then 1 else 0 end) DISK_RUN_INFO1,
- sum(case when f.DISK_RUN_INFO='2' then 1 else 0 end) DISK_RUN_INFO2,
- sum(case when f.DISK_RUN_INFO='3' then 1 else 0 end) DISK_RUN_INFO3,
- sum(case when e.LEAK_MAKE_SAFE='1' then 1 else 0 end) LEAK_MAKE_SAFE1,
- sum(case when e.HAS_ASTABLE='1' then 1 else 0 end) HAS_ASTABLE1,
- sum(case when f.HAS_SET_MAIN_FL='1' then 1 else 0 end) HAS_SET_MAIN_FL1,
- sum(case when f.IS_MAIN_FL_NORMAL='1' then 1 else 0 end) IS_MAIN_FL_NORMAL1,
- sum(case when f.IS_MAIN_FL_NORMAL='3' then 1 else 0 end) IS_MAIN_FL_NORMAL2,
- sum(case when f.IS_MAIN_FL_NORMAL='2' then 1 else 0 end) IS_MAIN_FL_NORMAL3,
- sum(case when instr(e.WAGA_DANG_DESC,'边墙失稳')>0 then 1 else 0 end) WAGA_DANG_DESC_SHIWEN,
- sum(case when instr(e.WAGA_DANG_DESC,'冲刷坝体及下游坝脚')>0 then 1 else 0 end) WAGA_DANG_DESC_CHONGSHUA,
- sum(case when f.HAS_SET_POUR_FL='1' then 1 else 0 end) HAS_SET_POUR_FL1,
- sum(case when f.POUR_FY_IS_NORMAL='1' then 1 else 0 end) POUR_FY_IS_NORMAL1,
- sum(case when f.POUR_FY_IS_NORMAL='3' then 1 else 0 end) POUR_FY_IS_NORMAL2,
- sum(case when f.POUR_FY_IS_NORMAL='2' then 1 else 0 end) POUR_FY_IS_NORMAL3,
- <!--安全鉴定情况-->
- sum(case when f.IF_DAM_SAFE='1' then 1 else 0 end) EXT_DAM_SAFE_APPR1,
- sum(case when f.IF_DAM_SAFE='2' then 1 else 0 end) EXT_DAM_SAFE_APPR2,
- sum(case when f.IF_DAM_SAFE='2' and f.IF_DAM_SAFE_REQ='2' then 1 else 0 end) EXT_DAM_SAFE_APPR3,
- sum(case when f.IF_DAM_SAFE='1' and f.IF_DAM_SAFE_RUL='1' then 1 else 0 end) DAM_SAFE_APPR_REQUIRE1,
- sum(case when f.IF_DAM_SAFE='1' and (f.IF_DAM_SAFE_RUL='2' or nullif(f.IF_DAM_SAFE_RUL,'') is null) then 1 else
- 0 end) DAM_SAFE_APPR_REQUIRE2,
- sum(case when f.IF_DAM_SAFE='1' and f.IF_DAM_SAFE_DEP_RUL='1' then 1 else 0 end) IF_DAM_SAFE_DEP_RUL1,
- sum(case when f.IF_DAM_SAFE='1' and (f.IF_DAM_SAFE_DEP_RUL='2' or nullif(f.IF_DAM_SAFE_DEP_RUL,'') is null) then
- 1 else 0 end) IF_DAM_SAFE_DEP_RUL2,
- <!--除险加固情况-->
- sum(case when f.IF_DAM_SAFE_THR='1' then 1 else 0 end) IF_FSLTDZ1,
- sum(case when f.IF_DAM_SAFE_THR='1' and f.IF_REIN_FORCE='1' then 1 else 0 end) IF_FSLTDZ2,
- sum(case when f.IF_DAM_SAFE_THR='1' and f.IF_REIN_FORCE='2' then 1 else 0 end) IF_FSLTDZ3,
- sum(case when f.IF_DAM_SAFE_THR='1' and f.REIN_FORCE_RUN='1' then 1 else 0 end) REIN_FORCE_RUN1,
- sum(case when f.IF_DAM_SAFE_THR='1' and f.REIN_FORCE_RUN='2' then 1 else 0 end) REIN_FORCE_RUN2,
- sum(case when f.IF_DAM_SAFE_THR='1' and f.REIN_FORCE_RUN2='1' then 1 else 0 end) REIN_FORCE_RUN21,
- sum(case when f.IF_DAM_SAFE_THR='1' and f.REIN_FORCE_RUN3='1' then 1 else 0 end) IF_COMPLATE_ACC1,
- sum(case when f.IF_DAM_SAFE_THR='1' and f.REIN_FORCE_RUN3='2' then 1 else 0 end) IF_COMPLATE_ACC2,
- sum(case when f.IF_DAM_SAFE_THR='1' and f.IF_REIN_IMP_GVE='1' then 1 else 0 end) IF_REIN_IMP_GVE1,
- sum(case when f.IF_DAM_SAFE_THR='1' and f.IF_REIN_IMP_GVE='2' then 1 else 0 end) IF_REIN_IMP_GVE2,
- sum(case when f.IF_DAM_SAFE_THR='1' and f.IF_REIN_IMP_PLAN='1' then 1 else 0 end) IF_REIN_IMP_PLAN1,
- sum(case when f.IF_DAM_SAFE_THR='1' and f.IF_REIN_IMP_PLAN='2' then 1 else 0 end) IF_REIN_IMP_PLAN2
- FROM
- (SELECT obj_id,rgstr_id,eng_scal,ad_code, STATE FROM BIS_INSP_RSVR_RGSTR) a
- LEFT JOIN
- BIS_INSP_ALL_OBJ b on a.obj_id = b.obj_id
- LEFT JOIN
- BIS_INSP_BASE_EXT c on a.rgstr_id = c.rgstr_id
- LEFT JOIN
- BIS_INSP_BASE_PRES_EXT d on a.rgstr_id = d.rgstr_id
- LEFT JOIN
- BIS_INSP_SAFE_EXT_MANAGE e on a.rgstr_id = e.rgstr_id
- LEFT JOIN
- BIS_INSP_RSVR_PROJECT f on a.rgstr_id = f.rgstr_id
- WHERE
- a.eng_scal in ('4','5')
- AND a.STATE = '2'
- AND length(b.id)=12
- AND b.id like '001%'
- <choose>
- <when test="id.length()==6">
- and substr(b.id,1,6) = #{id}
- </when>
- <when test="id.length()==9">
- and substr(b.id,1,9) = #{id}
- </when>
- <otherwise>
- and b.id = #{id}
- </otherwise>
- </choose>
- </select>
- <!--检查发现的主要问题-->
- <select id="getQTypeCount" resultType="java.util.HashMap">
- select
- sum(case when c.INSP_PBLM_CATE='3' then 1 else 0 end) INSP_PBLM_CATE0,
- sum(case when c.INSP_PBLM_CATE='2' then 1 else 0 end) INSP_PBLM_CATE1,
- sum(case when c.INSP_PBLM_CATE='1' then 1 else 0 end) INSP_PBLM_CATE2,
- sum(case when c.INSP_PBLM_CATE='0' then 1 else 0 end) INSP_PBLM_CATE3
- from
- BIS_INSP_ALL_OBJ b
- left join
- (select obj_id,rgstr_id,eng_scal, STATE from BIS_INSP_RSVR_RGSTR) a on a.obj_id = b.obj_id
- left join
- BIS_INSP_PBLM c on a.rgstr_id = c.REGID
- where
- a.eng_scal in ('4','5')
- and a.STATE = '2'
- and length(b.id)=12 and b.id like '001%'
- <choose>
- <when test="id.length()==6">
- and substr(b.id,1,6) = #{id}
- </when>
- <when test="id.length()==9">
- and substr(b.id,1,9) = #{id}
- </when>
- <otherwise>
- and b.id = #{id}
- </otherwise>
- </choose>
- </select>
- <select id="getRsvrQrr" resultType="cn.com.goldenwater.dcproj.param.RsvrQrrParam">
- select
- a.ad_code adCode, e.AD_FULL_NAME adFullName,
- count(1) con,
- sum(case when d.Has_Wiun_Wao_Leg_Pers='2' then 1 else 0 end) notWiunWaoLegPers,
- sum(case when d.Has_Tech_Pers='2' then 1 else 0 end) noTechPers,
- sum(case when d.Has_Patrol_Pers='2' then 1 else 0 end) notPatrolPers,
- sum(case when d.HAS_ATTEND_TRAIN='2' then 1 else 0 end) notAttendTrain
- from
- (select
- obj_id,rgstr_id,eng_scal,ad_code, STATE
- from BIS_INSP_RSVR_RGSTR) a
- left join
- BIS_INSP_ALL_OBJ b on a.obj_id = b.obj_id
- left join
- BIS_INSP_BASE_EXT c on a.rgstr_id = c.rgstr_id
- left join
- BIS_INSP_BASE_PRES_EXT d on a.rgstr_id = d.rgstr_id
- left join
- att_ad_x_base e on a.ad_code = e.ad_code
- where
- a.eng_scal in ('4','5')
- and a.STATE = '2'
- and length(b.id)=12 and b.id like '001%'
- <choose>
- <when test="id.length()==6">
- and substr(b.id,1,6) = #{id}
- </when>
- <when test="id.length()==9">
- and substr(b.id,1,9) = #{id}
- </when>
- <otherwise>
- and b.id = #{id}
- </otherwise>
- </choose>
- GROUP BY a.ad_code, e.AD_FULL_NAME
- </select>
- </mapper>
|