| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605 |
- <?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.BisInspTaskDthDayDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay" id="bisInspTaskDthDayResultMap">
- <result property="id" column="ID"/>
- <result property="orgId" column="ORG_ID"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="adName" column="AD_NAME"/>
- <result property="adFullName" column="AD_FULL_NAME"/>
- <result property="adGrad" column="AD_GRAD"/>
- <result property="tm" column="TM"/>
- <result property="objType" column="OBJ_TYPE"/>
- <result property="objName" column="OBJ_NAME"/>
- <result property="objSize" column="OBJ_SIZE"/>
- <result property="pblmSize" column="PBLM_SIZE"/>
- <result property="mendSize" column="MEND_SIZE"/>
- <result property="pblmLogSize" column="PBLM_LOG_SIZE"/>
- <result property="intm" column="INTM"/>
- <result property="uptm" column="UPTM"/>
- <result property="dataStat" column="DATA_STAT"/>
- <result property="infoPlbm" column="INFO_PLBM"/>
- <result property="warmPlbm" column="WARM_PLBM"/>
- <result property="errorPlbm" column="ERROR_PLBM"/>
- <result property="errorsPlbm" column="ERRORS_PLBM"/>
- <result property="checkYear" column="CHECK_YEAR"/>
- <result property="submitPlbm" column="SUBMIT_PLBM"/>
- </resultMap>
- <sql id="table_columns">
- ID,
- ORG_ID,
- AD_CODE,
- AD_NAME,
- AD_FULL_NAME,
- AD_GRAD,
- TM,
- OBJ_TYPE,
- OBJ_NAME,
- OBJ_SIZE,
- PBLM_SIZE,
- MEND_SIZE,
- PBLM_LOG_SIZE,
- INTM,
- UPTM,
- INFO_PLBM,
- WARM_PLBM,
- ERROR_PLBM,
- DATA_STAT
- </sql>
- <sql id="entity_properties">
- #{id},
- #{orgId},
- #{adCode},
- #{adName},
- #{adFullName},
- #{adGrad},
- #{tm},
- #{objType},
- #{objName},
- #{objSize},
- #{pblmSize},
- #{mendSize},
- #{pblmLogSize},
- #{intm},
- #{uptm},
- #{infoPlbm},
- #{warmPlbm},
- #{errorPlbm},
- #{dataStat}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
- <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
- <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
- <if test="adFullName != null and adFullName != ''">and AD_FULL_NAME = #{adFullName}</if>
- <if test="adGrad != null and adGrad != ''">and AD_GRAD = #{adGrad}</if>
- <if test="tm != null">and DATE_FORMAT(TM, '%Y-%m-%d') = DATE_FORMAT(#{tm}, '%Y-%m-%d')</if>
- <if test="objType != null and objType != ''">and OBJ_TYPE = #{objType}</if>
- <if test="objName != null and objName != ''">and OBJ_NAME = #{objName}</if>
- <if test="objSize != null and objSize != ''">and OBJ_SIZE = #{objSize}</if>
- <if test="pblmSize != null and pblmSize != ''">and PBLM_SIZE = #{pblmSize}</if>
- <if test="mendSize != null and mendSize != ''">and MEND_SIZE = #{mendSize}</if>
- <if test="pblmLogSize != null and pblmLogSize != ''">and PBLM_LOG_SIZE = #{pblmLogSize}</if>
- <if test="infoPlbm != null and infoPlbm != ''">and infoPlbm = #{INFO_PLBM}</if>
- <if test="warmPlbm != null and warmPlbm != ''">and warmPlbm = #{WARM_PLBM}</if>
- <if test="errorPlbm != null and errorPlbm != ''">and errorPlbm = #{ERROR_PLBM}</if>
- <if test="intm != null">and INTM = #{intm}</if>
- <if test="uptm != null">and UPTM = #{uptm}</if>
- <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
- and STR_TO_DATE(DATE_FORMAT(TM, '%Y-%m-%d'), '%Y-%m-%d') >= STR_TO_DATE(substr(#{sttm}, 1, 10), '%Y-%m-%d')
- and STR_TO_DATE(DATE_FORMAT(TM, '%Y-%m-%d'), '%Y-%m-%d') < DATE_ADD(STR_TO_DATE(substr(#{entm}, 1, 10), '%Y-%m-%d'), INTERVAL 1 DAY)
- </if>
- <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
- and DATA_STAT='0'
- </trim>
- </sql>
- <select id="get" resultMap="bisInspTaskDthDayResultMap" parameterType="String">
- select
- <include refid="table_columns"/>
- from BIS_INSP_TASK_DTH_DAY where ID = #{id}
- </select>
- <select id="getBy" resultMap="bisInspTaskDthDayResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_TASK_DTH_DAY
- <include refid="page_where"/>
- </select>
- <select id="findAll" resultMap="bisInspTaskDthDayResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_TASK_DTH_DAY
- </select>
- <select id="findList" resultMap="bisInspTaskDthDayResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_TASK_DTH_DAY
- <include refid="page_where"/>
- </select>
- <select id="selectCount" resultType="int">
- select count(ID) from BIS_INSP_TASK_DTH_DAY
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
- insert into BIS_INSP_TASK_DTH_DAY(
- <include refid="table_columns"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- update BIS_INSP_TASK_DTH_DAY set DATA_STAT='9' where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
- update BIS_INSP_TASK_DTH_DAY set DATA_STAT='9'
- <include refid="page_where"/>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update BIS_INSP_TASK_DTH_DAY set DATA_STAT = '9' where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
- update BIS_INSP_TASK_DTH_DAY
- <trim prefix="set" suffixOverrides=",">
- <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
- <if test="adGrad != null and adGrad != ''">AD_GRAD = #{adGrad},</if>
- <if test="tm != null">TM = #{tm},</if>
- <if test="objType != null and objType != ''">OBJ_TYPE = #{objType},</if>
- <if test="objName != null and objName != ''">OBJ_NAME = #{objName},</if>
- <if test="objSize != null and objSize != ''">OBJ_SIZE = #{objSize},</if>
- <if test="pblmSize != null and pblmSize != ''">PBLM_SIZE = #{pblmSize},</if>
- <if test="mendSize != null and mendSize != ''">MEND_SIZE = #{mendSize},</if>
- <if test="pblmLogSize != null and pblmLogSize != ''">PBLM_LOG_SIZE = #{pblmLogSize},</if>
- <if test="infoPlbm != null and infoPlbm != ''">infoPlbm = #{INFO_PLBM},</if>
- <if test="warmPlbm != null and warmPlbm != ''">warmPlbm = #{WARM_PLBM},</if>
- <if test="errorPlbm != null and errorPlbm != ''">errorPlbm = #{ERROR_PLBM},</if>
- <if test="intm != null">INTM = #{intm},</if>
- <if test="uptm != null">UPTM = #{uptm},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
- update BIS_INSP_TASK_DTH_DAY
- <trim prefix="set" suffixOverrides=",">
- <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
- <if test="adGrad != null and adGrad != ''">AD_GRAD = #{adGrad},</if>
- <if test="tm != null">TM = #{tm},</if>
- <if test="objType != null and objType != ''">OBJ_TYPE = #{objType},</if>
- <if test="objName != null and objName != ''">OBJ_NAME = #{objName},</if>
- <if test="objSize != null and objSize != ''">OBJ_SIZE = #{objSize},</if>
- <if test="pblmSize != null and pblmSize != ''">PBLM_SIZE = #{pblmSize},</if>
- <if test="mendSize != null and mendSize != ''">MEND_SIZE = #{mendSize},</if>
- <if test="pblmLogSize != null and pblmLogSize != ''">PBLM_LOG_SIZE = #{pblmLogSize},</if>
- <if test="infoPlbm != null and infoPlbm != ''">infoPlbm = #{INFO_PLBM},</if>
- <if test="warmPlbm != null and warmPlbm != ''">warmPlbm = #{WARM_PLBM},</if>
- <if test="errorPlbm != null and errorPlbm != ''">errorPlbm = #{ERROR_PLBM},</if>
- <if test="intm != null">INTM = #{intm},</if>
- <if test="uptm != null">UPTM = #{uptm},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- </trim>
- <include refid="page_where"/>
- </update>
- <!-- 其他自定义SQL -->
- <select id="findForCity" resultType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
- WITH O AS (
- <choose>
- <when test='objType == "8" '>
- SELECT
- '稽察工作' as NAME, r.AD_CODE, '8' as "OBJ_TYPE",
- COUNT( DISTINCT r.id ) OBJ_SIZE, COUNT( A.ID ) PBLM_SIZE,
- 0 as SUBMIT_PLBM,
- IFNULL( SUM( CASE A.PBLM_PASI WHEN '0' THEN 1 ELSE 0 END ), 0 ) INFO_PLBM,
- IFNULL( SUM( CASE A.PBLM_PASI WHEN '1' THEN 1 ELSE 0 END ), 0 ) WARM_PLBM,
- IFNULL( SUM( CASE A.PBLM_PASI WHEN '2' THEN 1 ELSE 0 END ), 0 ) ERROR_PLBM,
- IFNULL( SUM( CASE A.PBLM_PASI WHEN '3' THEN 1 ELSE 0 END ), 0 ) ERRORS_PLBM,
- 0 as PBLM_LOG_SIZE , 0 as MEND_SIZE
- FROM TAC_INSP_YEAR_BATCH_OBJ O
- LEFT JOIN tac_pawp_rgstr r ON o.id = r.obj_id
- LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_INFO WHERE STEP_ID = #{lastStepId}) A ON A.rgstr_id = r.id
- <where>
- <if test="year != null and year != ''">and O.YEAR = #{year}</if>
- <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
- <if test="province != null and province != ''">and O.PROVINCE = #{province}</if>
- <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
- and R.INTM >= STR_TO_DATE(#{sttm}, '%Y-%m-%d') and R.INTM < DATE_ADD(STR_TO_DATE(#{entm}, '%Y-%m-%d'), INTERVAL 1 DAY)
- </if>
- </where>
- GROUP BY r.AD_CODE, '8', R.INTM
- </when>
- <otherwise>
- SELECT
- A.NAME,
- <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
- <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
- ( case when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '350128' then '351000000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371201' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371202' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371203' then '370117000000' else O.OBJ_AD_CODE end) AS "AD_CODE",
- O.PTYPE as "OBJ_TYPE",
- COUNT( DISTINCT O.OBJ_ID ) OBJ_SIZE,
- COUNT(DISTINCT case when P.PBLM_ID is not null then P.PBLM_ID end ) PBLM_SIZE,
- IFNULL( SUM( CASE WHEN P.STATE = '2' THEN 1 ELSE 0 END ), 0 ) SUBMIT_PLBM,
- IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ), 0 ) INFO_PLBM,
- IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ), 0 ) WARM_PLBM,
- IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ), 0 ) ERROR_PLBM,
- IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END ), 0 ) ERRORS_PLBM,
- IFNULL( SUM( CASE PL.PBLM_OUT WHEN '1' THEN 1 ELSE 0 END ), 0 ) PBLM_LOG_SIZE,
- IFNULL( COUNT(DISTINCT CASE when PL.PBLM_ID is not null then P.PBLM_ID end ), 0 ) MEND_SIZE
- FROM
- BIS_INSP_ALL_OBJ O
- JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
- <where>
- <if test='orgId != null and orgId != "" '>
- AND ORG_ID = #{orgId}
- </if>
- </where>
- )) A ON A.PTYPE = O.PTYPE
- LEFT JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
- LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
- <where>
- <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
- <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
- <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
- and O.OBJ_INTM >= STR_TO_DATE(#{sttm}, '%Y-%m-%d') and O.OBJ_INTM < DATE_ADD(STR_TO_DATE(#{entm}, '%Y-%m-%d'), INTERVAL 1 DAY)
- </if>
- </where>
- GROUP BY A.NAME,O.OBJ_AD_CODE, O.PTYPE
- </otherwise>
- </choose>
- )
- SELECT
- ( case when SUBSTR(A.AD_CODE, 1, 6) = '350000' then '359900000000' else A.AD_CODE end) as AD_CODE, A.AD_NAME, A.LGTD, A.LTTD,
- SUM(OBJ_SIZE) OBJ_SIZE,
- SUM(PBLM_SIZE) PBLM_SIZE, SUM(SUBMIT_PLBM) SUBMIT_PLBM, SUM(INFO_PLBM) INFO_PLBM,
- SUM(WARM_PLBM) WARM_PLBM, SUM(ERROR_PLBM) ERROR_PLBM, SUM(ERRORS_PLBM) ERRORS_PLBM, SUM(PBLM_LOG_SIZE) PBLM_LOG_SIZE, SUM(MEND_SIZE) MEND_SIZE
- FROM
- <choose>
- <when test='adGrad == "4" '>
- <!-- 县区 -->
- <choose>
- <when test=' adCode == "3501" '>
- <!-- 福建省 福州市 排除 平潭县 -->
- (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '4' and AD_CODE LIKE '${adCode}%' and SUBSTR(AD_CODE, 1, 6) !='350128' )A
- </when>
- <when test=' adCode == "3510" '>
- <!-- 福建省 平潭实验区-->
- (select (case when SUBSTR(AD_CODE, 1, 6) = '350128' then '351000000000' else AD_CODE end) AS "AD_CODE", AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE (ad_grad= '4' and AD_CODE LIKE '${adCode}%' ) or SUBSTR(AD_CODE, 1, 6) ='350128' )A
- </when>
- <otherwise>
- <!-- 除去福建省 的其他省份-->
- (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '4' and AD_CODE LIKE '${adCode}%') A
- </otherwise>
- </choose>
- </when>
- <otherwise>
- <choose>
- <when test=' adCode == "35" '>
- <!-- 福建省 增加省本级 -->
- (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '3' and AD_CODE LIKE '${adCode}%'
- UNION ALL
- select '350000000000' as AD_CODE , '省本级' as AD_NAME, null as LGTD, null as LTTD from ATT_AD_BASE where ad_code = '350100000000'
- )A
- </when>
- <when test=' adCode == "3500" '>
- <!-- 省本级 -->
- (
- select '350000000000' as AD_CODE , '省本级' as AD_NAME, null as LGTD, null as LTTD from dual
- )A
- </when>
- <otherwise>
- <!-- 除去福建省 的其他省份-->
- (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '3' and AD_CODE LIKE '${adCode}%') A
- </otherwise>
- </choose>
- </otherwise>
- </choose>
- LEFT JOIN (
- SELECT
- <choose>
- <when test='adGrad == "4" '>
- concat(SUBSTR(AD_CODE, 1, 6) , '000000') AD_CODE,
- </when>
- <otherwise>
- concat(SUBSTR(AD_CODE, 1, 4) , '00000000') AD_CODE,
- </otherwise>
- </choose>
- OBJ_TYPE, OBJ_SIZE, PBLM_SIZE, SUBMIT_PLBM,INFO_PLBM, WARM_PLBM, ERROR_PLBM, ERRORS_PLBM,PBLM_LOG_SIZE,MEND_SIZE
- FROM o
- <where>
- <if test="adCode != null and adCode != ''">and o.AD_CODE LIKE '${adCode}%'</if>
- </where>
- ) T ON T.AD_CODE = A.AD_CODE
- <where>
- <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
- <if test="adCode == '66'">and a.ad_code != '661100000000'</if> <!--为了去除首页三维地图没有十一师的坐标-->
- </where>
- GROUP BY A.AD_CODE, A.AD_NAME, A.LGTD, A.LTTD
- ORDER BY A.AD_CODE
- </select>
- <select id="findForObjType" resultType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
- SELECT
- OBJ_NAME,
- OBJ_TYPE,
- SUM(OBJ_SIZE) OBJ_SIZE,
- SUM(PBLM_SIZE) PBLM_SIZE, SUM(SUBMIT_PLBM) SUBMIT_PLBM,SUM(INFO_PLBM) INFO_PLBM,
- SUM(WARM_PLBM) WARM_PLBM, SUM(ERROR_PLBM) ERROR_PLBM, SUM(ERRORS_PLBM) ERRORS_PLBM, SUM(PBLM_LOG_SIZE) PBLM_LOG_SIZE, SUM(MEND_SIZE) MEND_SIZE
- FROM
- (
- SELECT OBJ_NAME,
- <choose>
- <when test='adGrad == "4" '>
- concat(SUBSTR(AD_CODE, 1, 6) , '000000') AD_CODE,
- </when>
- <otherwise>
- concat(SUBSTR(AD_CODE, 1, 4) , '00000000') AD_CODE,
- </otherwise>
- </choose>
- OBJ_TYPE, OBJ_SIZE, PBLM_SIZE,SUBMIT_PLBM, INFO_PLBM, WARM_PLBM, ERROR_PLBM, ERRORS_PLBM,PBLM_LOG_SIZE,MEND_SIZE
- FROM (
- SELECT
- AIT.NAME AS "OBJ_NAME",
- <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
- <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
- ( case when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '350128' then '351000000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371201' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371202' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371203' then '370117000000' else O.OBJ_AD_CODE end) AS "AD_CODE",
- O.PTYPE as "OBJ_TYPE",
- COUNT( DISTINCT O.OBJ_ID ) OBJ_SIZE,
- COUNT(DISTINCT case when P.PBLM_ID is not null then P.PBLM_ID end ) PBLM_SIZE,
- IFNULL( SUM( CASE WHEN P.STATE = '2' THEN 1 ELSE 0 END ), 0 ) SUBMIT_PLBM,
- IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ), 0 ) INFO_PLBM,
- IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ), 0 ) WARM_PLBM,
- IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ), 0 ) ERROR_PLBM,
- IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END ), 0 ) ERRORS_PLBM,
- IFNULL( SUM( CASE PL.PBLM_OUT WHEN '1' THEN 1 ELSE 0 END ), 0 ) PBLM_LOG_SIZE,
- IFNULL( COUNT(DISTINCT CASE when PL.PBLM_ID is not null then P.PBLM_ID end ), 0 ) MEND_SIZE
- FROM
- BIS_INSP_ALL_OBJ O
- JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
- <where>
- <if test='orgId != null and orgId != "" '>
- AND ORG_ID = #{orgId}
- </if>
- </where>
- )) AIT ON AIT.PTYPE = O.PTYPE
- LEFT JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
- LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
- <where>
- <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
- <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
- <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
- and O.OBJ_INTM >= STR_TO_DATE(#{sttm}, '%Y-%m-%d') and O.OBJ_INTM < DATE_ADD(STR_TO_DATE(#{entm}, '%Y-%m-%d'), INTERVAL 1 DAY)
- </if>
- </where>
- GROUP BY AIT.NAME,O.OBJ_AD_CODE, O.PTYPE
- ) o
- <where>
- <if test="adCode != null and adCode != ''">and o.AD_CODE LIKE '${adCode}%'</if>
- </where>
- ) T
- GROUP BY T.OBJ_NAME, T.OBJ_TYPE
- ORDER BY cast(T.OBJ_TYPE as unsigned)
- </select>
- <select id="findForCityObjType" resultType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
- WITH O AS (
- SELECT
- A.NAME as "OBJ_NAME",
- <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
- <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
- ( case when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '350128' then '351000000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371201' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371202' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371203' then '370117000000' else O.OBJ_AD_CODE end) AS "AD_CODE",
- O.PTYPE as "OBJ_TYPE",
- COUNT( DISTINCT O.OBJ_ID ) OBJ_SIZE,
- COUNT(DISTINCT case when P.PBLM_ID is not null then P.PBLM_ID end ) PBLM_SIZE,
- IFNULL( SUM( CASE WHEN P.STATE = '2' THEN 1 ELSE 0 END ), 0 ) SUBMIT_PLBM,
- IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ), 0 ) INFO_PLBM,
- IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ), 0 ) WARM_PLBM,
- IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ), 0 ) ERROR_PLBM,
- IFNULL( SUM( CASE P.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END ), 0 ) ERRORS_PLBM,
- IFNULL( SUM( CASE PL.PBLM_OUT WHEN '1' THEN 1 ELSE 0 END ), 0 ) PBLM_LOG_SIZE,
- IFNULL( COUNT(DISTINCT CASE when PL.PBLM_ID is not null then P.PBLM_ID end ), 0 ) MEND_SIZE
- FROM
- BIS_INSP_ALL_OBJ O
- JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
- <where>
- <if test='orgId != null and orgId != "" '>
- AND ORG_ID = #{orgId}
- </if>
- </where>
- )) A ON A.PTYPE = O.PTYPE
- LEFT JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
- LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
- <where>
- <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
- <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
- <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
- and O.OBJ_INTM >= STR_TO_DATE(#{sttm}, '%Y-%m-%d') and O.OBJ_INTM < DATE_ADD(STR_TO_DATE(#{entm}, '%Y-%m-%d'), INTERVAL 1 DAY)
- </if>
- </where>
- GROUP BY A.NAME,O.OBJ_AD_CODE, O.PTYPE
- )
- SELECT
- ( case when SUBSTR(A.AD_CODE, 1, 6) = '350000' then '359900000000' else A.AD_CODE end) as AD_CODE, A.AD_NAME, A.LGTD, A.LTTD,
- T.OBJ_NAME, T.OBJ_TYPE,
- SUM(OBJ_SIZE) OBJ_SIZE,
- SUM(PBLM_SIZE) PBLM_SIZE, SUM(SUBMIT_PLBM) SUBMIT_PLBM,SUM(INFO_PLBM) INFO_PLBM,
- SUM(WARM_PLBM) WARM_PLBM, SUM(ERROR_PLBM) ERROR_PLBM, SUM(ERRORS_PLBM) ERRORS_PLBM, SUM(PBLM_LOG_SIZE) PBLM_LOG_SIZE, SUM(MEND_SIZE) MEND_SIZE
- FROM
- <choose>
- <when test='adGrad == "4" '>
- <!-- 县区 -->
- <choose>
- <when test=' adCode == "3501" '>
- <!-- 福建省 福州市 排除 平潭县 -->
- (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '4' and AD_CODE LIKE '${adCode}%' and SUBSTR(AD_CODE, 1, 6) !='350128' )A
- </when>
- <when test=' adCode == "3510" '>
- <!-- 福建省 平潭实验区-->
- (select (case when SUBSTR(AD_CODE, 1, 6) = '350128' then '351000000000' else AD_CODE end) AS "AD_CODE", AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE (ad_grad= '4' and AD_CODE LIKE '${adCode}%' ) or SUBSTR(AD_CODE, 1, 6) ='350128' )A
- </when>
- <otherwise>
- <!-- 除去福建省 的其他省份-->
- (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '4' and AD_CODE LIKE '${adCode}%') A
- </otherwise>
- </choose>
- </when>
- <otherwise>
- <choose>
- <when test=' adCode == "35" '>
- <!-- 福建省 增加省本级 -->
- (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '3' and AD_CODE LIKE '${adCode}%'
- UNION ALL
- select '350000000000' as AD_CODE , '省本级' as AD_NAME, LGTD, LTTD from ATT_AD_BASE where ad_code = '350100000000'
- )A
- </when>
- <when test=' adCode == "3500" '>
- <!-- 省本级 -->
- (
- select '350000000000' as AD_CODE , '省本级' as AD_NAME, LGTD, LTTD from ATT_AD_BASE where ad_code = '350100000000'
- )A
- </when>
- <otherwise>
- <!-- 除去福建省 的其他省份-->
- (select AD_CODE, AD_NAME, LGTD, LTTD from ATT_AD_BASE WHERE ad_grad= '3' and AD_CODE LIKE '${adCode}%') A
- </otherwise>
- </choose>
- </otherwise>
- </choose>
- LEFT JOIN (
- SELECT
- <choose>
- <when test='adGrad == "4" '>
- concat(SUBSTR(AD_CODE, 1, 6) , '000000') AD_CODE,
- </when>
- <otherwise>
- cocnat(SUBSTR(AD_CODE, 1, 4) , '00000000') AD_CODE,
- </otherwise>
- </choose>
- OBJ_NAME, OBJ_TYPE, OBJ_SIZE, PBLM_SIZE,SUBMIT_PLBM,INFO_PLBM, WARM_PLBM, ERROR_PLBM, ERRORS_PLBM,PBLM_LOG_SIZE,MEND_SIZE
- FROM o
- <where>
- <if test="adCode != null and adCode != ''">and o.AD_CODE LIKE '${adCode}%'</if>
- </where>
- ) T ON T.AD_CODE = A.AD_CODE
- <where>
- <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
- <if test="adCode == '66'">and a.ad_code != '661100000000'</if> <!--为了去除首页三维地图没有十一师的坐标-->
- </where>
- GROUP BY A.AD_CODE, A.AD_NAME, A.LGTD, A.LTTD ,T.OBJ_NAME, T.OBJ_TYPE
- ORDER BY A.AD_CODE , cast(T.OBJ_TYPE as unsigned)
- </select>
- <select id="findForCityObjTypeYearsCompare" resultMap="bisInspTaskDthDayResultMap" >
- WITH O AS (
- SELECT
- A.NAME as "OBJ_NAME",
- <!-- 把福建省福州市下的平潭县 提到到平潭综合实验区 -->
- <!-- 把山东省莱芜市下的市辖区、莱芜区 归属到济南市莱芜区,钢城区 归属到济南市的钢城区, -->
- ( case when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '350128' then '351000000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371201' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371202' then '370116000000' when SUBSTR(O.OBJ_AD_CODE, 1, 6) = '371203' then '370117000000' else O.OBJ_AD_CODE end) AS "AD_CODE",
- O.PTYPE as "OBJ_TYPE",
- O.OBJ_ID,
- DATE_FORMAT(O.OBJ_INTM, '%Y') OTM,
- P.PBLM_ID,
- P.INSP_PBLM_CATE,
- P.DATA_STAT,
- P.STATE,
- PL.PBLM_ID PL_PBLM_ID,
- PL.PBLM_OUT PL_PBLM_OUT
- FROM BIS_INSP_ALL_OBJ O
- JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
- <where>
- <if test='orgId != null and orgId != "" '>
- AND ORG_ID = #{orgId}
- </if>
- </where>
- )) A ON A.PTYPE = O.PTYPE
- LEFT JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
- LEFT JOIN BIS_INSP_PBLM_PLIST Pl ON PL.PBLM_ID = P.PBLM_ID and PL.DATA_STAT='0'
- <where>
- <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
- <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
- <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
- and O.OBJ_INTM >= STR_TO_DATE(#{sttm}, '%Y-%m-%d') and O.OBJ_INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 DAY)
- </if>
- </where>
- )
- SELECT CHECK_YEAR,OBJ_TYPE,OBJ_NAME,OBJ_SIZE, PBLM_SIZE,INFO_PLBM,SUBMIT_PLBM,WARM_PLBM,ERROR_PLBM,ERRORS_PLBM,MEND_SIZE,PBLM_LOG_SIZE
- FROM (
- SELECT O1.OTM AS "CHECK_YEAR", O1.OBJ_TYPE, O1.OBJ_NAME, O1.OBJ_SIZE, IFNULL(O2.PBLM_SIZE,0) AS "PBLM_SIZE", IFNULL(O2.INFO_PLBM,0) AS "INFO_PLBM",IFNULL(O2.SUBMIT_PLBM,0) AS "SUBMIT_PLBM", IFNULL(O2.WARM_PLBM,0) AS "WARM_PLBM", IFNULL(O2.ERROR_PLBM,0) AS "ERROR_PLBM", IFNULL(O2.ERRORS_PLBM,0) AS "ERRORS_PLBM", IFNULL(O2.MEND_SIZE,0) AS "MEND_SIZE", IFNULL(O2.PBLM_LOG_SIZE ,0) AS "PBLM_LOG_SIZE"
- from ( SELECT
- OTM ,COUNT( DISTINCT O.OBJ_ID ) OBJ_SIZE, OBJ_TYPE, OBJ_NAME
- FROM O
- <where>
- <if test="adCode != null and adCode != ''">and AD_CODE LIKE '${adCode}%'</if>
- <if test='adCode == "66"'>and ad_code != '661100000000'</if> <!--为了去除首页三维地图没有十一师的坐标-->
- </where>
- GROUP BY OTM, OBJ_TYPE, OBJ_NAME
- ) O1
- LEFT JOIN
- ( SELECT
- OTM ,COUNT(DISTINCT case when O.PBLM_ID is not null then O.PBLM_ID end ) PBLM_SIZE,
- IFNULL( SUM( CASE WHEN O.STATE = '2' THEN 1 ELSE 0 END ), 0 ) SUBMIT_PLBM,
- IFNULL( SUM( CASE O.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ), 0 ) INFO_PLBM,
- IFNULL( SUM( CASE O.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ), 0 ) WARM_PLBM,
- IFNULL( SUM( CASE O.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ), 0 ) ERROR_PLBM,
- IFNULL( SUM( CASE O.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END ), 0 ) ERRORS_PLBM,
- IFNULL( SUM( CASE O.PL_PBLM_OUT WHEN '1' THEN 1 ELSE 0 END ), 0 ) PBLM_LOG_SIZE,
- IFNULL( COUNT(DISTINCT CASE when O.PL_PBLM_ID is not null then O.PL_PBLM_ID end ), 0 ) MEND_SIZE
- , OBJ_TYPE, OBJ_NAME
- FROM O
- <where>
- <if test="adCode != null and adCode != ''">and AD_CODE LIKE '${adCode}%'</if>
- <if test='adCode == "66"'>and ad_code != '661100000000'</if> <!--为了去除首页三维地图没有十一师的坐标-->
- </where>
- GROUP BY OTM, OBJ_TYPE, OBJ_NAME
- ) O2 on O1.OTM = O2.OTM and O1.OBJ_TYPE = O2.OBJ_TYPE and O1.OBJ_NAME = O2.OBJ_NAME
- ) W
- </select>
- <select id="selectCurObjTypeList" resultType="cn.com.goldenwater.dcproj.model.BisInspTaskDthDay">
- SELECT
- AIT.NAME AS "OBJ_NAME",
- O.PTYPE as "OBJ_TYPE"
- FROM
- BIS_INSP_ALL_OBJ O
- JOIN (select * FROM ATT_INSP_TYPE where code IN (select INSP_TYPE FROM REL_ORG_INSP_TYPE
- <where>
- <if test='orgId != null and orgId != "" '>
- AND ORG_ID = #{orgId}
- </if>
- </where>
- )) AIT ON AIT.PTYPE = O.PTYPE
- <where>
- <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</if>
- <if test="orgId != null and orgId != ''">AND O.ID LIKE '___${orgId}%'</if>
- <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
- and O.OBJ_INTM >= STR_TO_DATE(#{sttm}, '%Y-%m-%d') and O.OBJ_INTM < DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 DAY)
- </if>
- <if test="adCode != null and adCode != ''">and SUBSTR(O.OBJ_AD_CODE, 1, 2) = SUBSTR(#{adCode}, 1, 2) </if>
- </where>
- GROUP BY AIT.NAME, O.PTYPE
- ORDER BY cast(O.PTYPE as unsigned)
- </select>
- </mapper>
|