| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941 |
- <?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.TaskDthDayCountDao">
- <resultMap type="cn.com.goldenwater.dcproj.dto.BisInspTaskTotal" id="BisInspTaskTotalResultMap">
- <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="infoPlbm" column="INFO_PLBM"/>
- <result property="warmPlbm" column="WARM_PLBM"/>
- <result property="errorPlbm" column="ERROR_PLBM"/>
- </resultMap>
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspTaskTypeItemTotal" id="BisInspTaskTypeItemTotalResultMap">
- <result property="itemName" column="INSP_PBLM_NAME"/>
- <result property="pblmSize" column="PBLM_SIZE"/>
- <result property="mendSize" column="MEND_SIZE"/>
- <result property="pblmLogSize" column="PBLM_LOG_SIZE"/>
- <result property="infoPlbm" column="INFO_PLBM"/>
- <result property="warmPlbm" column="WARM_PLBM"/>
- <result property="errorPlbm" column="ERROR_PLBM"/>
- </resultMap>
- <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 TM = #{tm}</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="intm != null">and INTM = #{intm}</if>
- <if test="uptm != null">and UPTM = #{uptm}</if>
- <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
- and DATA_STAT='0'
- </trim>
- </sql>
- <select id="getListByTm" resultMap="BisInspTaskTotalResultMap">
- select
- count(*) OBJ_SIZE
- from
- BIS_INSP_ALL_OBJ O
- <where>
- <if test="objType != null and objType != '' ">
- and PTYPE = #{objType}
- </if>
- <if test='stTm != null and stTm != "" '>
- and OBJ_INTM >= STR_TO_DATE(#{stTm}, '%Y-%m-%d')
- </if>
- <if test='enTm != null and enTm != "" '>
- and OBJ_INTM < date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
- </if>
- <if test="adCode != null and adCode != '' ">
- and OBJ_AD_CODE like '${adCode}%'
- </if>
- </where>
- </select>
- <select id="getListJichaByTm" resultType="cn.com.goldenwater.dcproj.dto.BisInspTaskTotal">
- select
- count(*) OBJ_SIZE
- from
- TAC_PAWP_RGSTR O
- <where>
- DATA_STAT = '0'
- <if test='stTm != null and stTm != "" '>
-
- and INTM >= STR_TO_DATE(#{stTm}, '%Y-%m-%d')
- </if>
- <if test='enTm != null and enTm != "" '>
- and INTM < date_add( STR_TO_DATE(#{enTm},'%Y-%m-%d'), INTERVAL 1 day )
- </if>
- <if test="adCode != null and adCode != '' ">
- and AD_CODE like '${adCode}%'
- </if>
- </where>
- </select>
- <select id="getPblmListByTm" resultMap="BisInspTaskTotalResultMap">
- SELECT
- ifnull(COUNT(A.PBLM_ID),0) PBLM_SIZE,
- IFNULL(SUM( CASE A.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ), 0) INFO_PLBM,
- IFNULL(SUM( CASE A.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ), 0) WARM_PLBM,
- IFNULL(SUM( CASE A.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ), 0) ERROR_PLBM,
- IFNULL(SUM( CASE A.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END ), 0) ERROR_PLBM
- FROM BIS_INSP_PBLM A
- WHERE a.obj_type = #{objType}
- and a.coll_time >= STR_TO_DATE(#{stTm}, '%Y-%m-%d')
- and a.coll_time < date_add(str_to_date(#{enTm}, '%Y-%m-%d'), INTERVAL 1 day )
- <if test="adCode != null and adCode != '' ">
- and A.OBJ_AD_CODE like '${adCode}%'
- </if>
- </select>
- <select id="getPblmListJichaByTm" resultMap="BisInspTaskTotalResultMap">
- SELECT
- ifnull(COUNT(A.ID),0) PBLM_SIZE,
- 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
- FROM TAC_PBLM_INFO A
- JOIN TAC_PAWP_RGSTR R ON A.RGSTR_ID=R.ID
- WHERE
- R.DATA_STAT= '0'
- AND A.INTM >= str_to_date(#{stTm},'%Y-%m-%d')
- AND A.INTM < date_add( str_to_date(#{enTm},'%Y-%m-%d'), INTERVAL 1 day )
- <if test="adCode != null and adCode != '' ">
- and r.AD_CODE like '${adCode}%'
- </if>
- </select>
- <select id="getPblmListTypeByTm" resultMap="BisInspTaskTypeItemTotalResultMap">
- SELECT
- A.INSP_PBLM_NAME, ifnull(COUNT( A.PBLM_ID ),0) PBLM_SIZE, 0 AS "MEND_SIZE", 0 AS "PBLM_LOG_SIZE",
- SUM( CASE A.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ) INFO_PLBM,
- SUM( CASE A.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ) WARM_PLBM,
- SUM( CASE A.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ) ERROR_PLBM
- FROM BIS_INSP_PBLM A
- WHERE
- A.INSP_PBLM_NAME IS NOT NULL
- and a.obj_type = #{objType}
- and a.coll_time >= str_to_date(#{stTm},'%Y-%m-%d')
- and a.coll_time < date_add( str_to_date(#{enTm},'%Y-%m-%d'), INTERVAL 1 day )
- <if test="adCode != null and adCode != '' ">
- and A.OBJ_AD_CODE like '${adCode}%'
- </if>
- GROUP BY INSP_PBLM_NAME
- </select>
- <select id="getPblmListTypeJichaByTm" resultMap="BisInspTaskTypeItemTotalResultMap">
- SELECT
- TB.SPFSNL_TYPE, ifnull(COUNT( A.ID ),0) PBLM_SIZE, 0 AS "MEND_SIZE", 0 AS "PBLM_LOG_SIZE",
- SUM( CASE A.PBLM_PASI WHEN '0' THEN 1 ELSE 0 END ) INFO_PLBM,
- SUM( CASE A.PBLM_PASI WHEN '1' THEN 1 ELSE 0 END ) WARM_PLBM,
- SUM( CASE A.PBLM_PASI WHEN '2' THEN 1 ELSE 0 END ) ERROR_PLBM
- FROM TAC_PBLM_INFO A JOIN TAC_PAWP_RGSTR R ON A.RGSTR_ID=R.ID
- LEFT JOIN TAC_OBJ_PBLMSTB TB ON TB.ID = A.PBLMSTD_ID
- WHERE
- R.DATA_STAT = '0'
- AND TB.SPFSNL_TYPE IS NOT NULL
- and a.INTM >= str_to_date(#{stTm},'%Y-%m-%d')
- and a.INTM < date_add( str_to_date(#{enTm},'%Y-%m-%d'), INTERVAL 1 day )
- <if test="adCode != null and adCode != '' ">
- and R.AD_CODE like '${adCode}%'
- </if>
- GROUP BY TB.SPFSNL_TYPE
- </select>
- <select id="getPblmListTypeJiChaByTm" resultMap="BisInspTaskTypeItemTotalResultMap">
- SELECT
- A.*, ifnull(B.PBLM_LOG_SIZE, 0) AS "PBLM_LOG_SIZE"
- FROM
- (
- SELECT
- A.INSP_PBLM_NAME, ifnull(COUNT( A.PBLM_ID ),0) PBLM_SIZE, 0 AS "MEND_SIZE",
- SUM( CASE A.INSP_PBLM_CATE WHEN '0' THEN 1 ELSE 0 END ) INFO_PLBM,
- SUM( CASE A.INSP_PBLM_CATE WHEN '1' THEN 1 ELSE 0 END ) WARM_PLBM,
- SUM( CASE A.INSP_PBLM_CATE WHEN '2' THEN 1 ELSE 0 END ) ERROR_PLBM
- FROM BIS_INSP_PBLM A
- JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID = B.OBJ_ID
- WHERE
- A.DATA_STAT = '0'
- AND A.INSP_PBLM_NAME IS NOT NULL
- and a.coll_time >= str_to_date(#{stTm}, '%Y-%m-%d')
- and a.coll_time < date_add( str_to_date(#{enTm},'%Y-%m-%d'), INTERVAL 1 day )
- <if test="adCode != null and adCode != '' ">
- and B.OBJ_AD_CODE like '${adCode}%'
- </if>
- GROUP BY INSP_PBLM_NAME
- ) A
- LEFT JOIN (
- SELECT
- A.INSP_PBLM_NAME, ifnull(COUNT( A.PBLM_ID ),0) PBLM_LOG_SIZE
- FROM BIS_INSP_PBLM_DEL_LOG A
- JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID = B.OBJ_ID
- WHERE
- a.obj_type = '8'
- and a.coll_time BETWEEN STR_TO_DATE(#{stTm}, '%Y-%m-%d') and STR_TO_DATE(#{enTm}, '%Y-%m-%d')
- <if test="adCode != null and adCode != '' ">
- and B.OBJ_AD_CODE like '${adCode}%'
- </if>
- GROUP BY A.INSP_PBLM_NAME
- ) B ON A.INSP_PBLM_NAME = B.INSP_PBLM_NAME
- </select>
- <select id="getObjSize" resultType="java.util.Map">
- select
- ifnull(count(*), 0) OBJSIZE
- 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 O.PTYPE = A.PTYPE
- JOIN BIS_INSP_ALL AL ON O.ID = AL.ID
- <where>
- <if test="orgId != null and orgId != '' ">AND O.ID LIKE '___${orgId}%'</if>
- <if test="province != null and province != '' ">AND O.OBJ_AD_CODE LIKE CONCAT(#{province}, '%')</if>
- <if test="adCode != null and adCode != '' ">and O.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
- <if test="objType != null and objType != '' ">and O.PTYPE = #{objType}</if>
- <if test='sttm != null and "" != sttm '>and O.OBJ_INTM >= str_to_date(#{sttm}, '%Y-%m-%d')</if>
- <if test='entm != null and "" != entm '>and O.OBJ_INTM < date_add( str_to_date(#{entm},'%Y-%m-%d'), INTERVAL 1 day ) </if>
- </where>
- </select>
- <!-- lxf 2022/11/22 督查对象重复数量 -->
- <select id="getObjSizeRepeat" resultType="java.util.Map">
- select
- <!-- 统计督查对象 重复数量 add lxf 2022/11/19 -->
- IFNULL(count(*), 0) OBJSIZEREPEAT
- 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 O.PTYPE = A.PTYPE
- where O.code IN
- ( SELECT biaoin.code FROM BIS_INSP_ALL_OBJ biaoin
- <where>
- <if test="orgId != null and orgId != '' ">AND biaoin.ORG_ID = #{orgId} </if>
- <if test='adCode != null and adCode != "" '> AND biaoin.OBJ_AD_CODE like '${adCode}%'</if>
- <if test="orgId != null and orgId != '' ">AND biaoin.ID LIKE '___${orgId}%'</if>
- <if test="province != null and province != '' ">AND biaoin.OBJ_AD_CODE LIKE CONCAT(#{province}, '%')</if>
- <if test="adCode != null and adCode != '' ">and biaoin.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
- <if test="objType != null and objType != '' ">and biaoin.PTYPE = #{objType}</if>
- <if test="sttm != null and sttm != '' ">and biaoin.OBJ_INTM >= str_to_date(#{sttm}, '%Y-%m-%d')</if>
- <if test="entm != null and entm != '' ">and biaoin.OBJ_INTM < date_add( str_to_date(#{entm},'%Y-%m-%d'), INTERVAL 1 day ) </if>
- </where>
- GROUP BY biaoin.code, biaoin.PTYPE HAVING count( biaoin.code ) > 1
- )
- </select>
- <select id="getPblmSize" resultType="java.util.Map">
- <!--WITH O AS (
- )-->
- SELECT
- ifnull(SUM(PBLM_SIZE),0) PBLMSIZE
- FROM (
- SELECT
- A.NAME,O.OBJ_AD_CODE, O.PTYPE,
- ifnull(COUNT(distinct P.PBLM_ID ),0) PBLM_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
- JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
- <where>
- <if test="orgId != null and orgId != '' ">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
- ) O
- <where>
- <if test="adCode != null and adCode != '' ">AND OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
- <if test="province != null and province != '' ">AND OBJ_AD_CODE LIKE CONCAT(#{province}, '%')</if>
- <if test="objType != null and objType != '' ">AND PTYPE = #{objType}</if>
- </where>
- </select>
- <select id="getDelPblmSize" resultType="java.util.Map">
- SELECT
- ifnull(COUNT(A.PBLM_ID), 0) PBLMLOGSIZE
- FROM
- BIS_INSP_PBLM_DEL_LOG A
- JOIN
- BIS_INSP_ALL_OBJ B ON A.OBJ_ID=B.OBJ_ID
- <where>
- <if test="adCode != null and adCode != '' ">
- substr(b.OBJ_AD_CODE,1,2)=#{adCode}
- </if>
- </where>
- </select>
- <select id="getObjTypeSize" resultType="java.util.Map">
- select ifnull(count(*), 0) OBJTYPESIZE
- from REL_ORG_INSP_TYPE
- <where>
- <if test="orgId != null and orgId != '' ">
- ORG_ID = #{orgId}
- </if>
- </where>
- </select>
- <select id="getHasObjSize" resultType="java.util.Map">
- SELECT ifnull(count(DISTINCT O.OBJ_ID),0) HASOBJSIZE
- FROM (
- SELECT * FROM BIS_INSP_ALL_OBJ
- <where>
- <if test="province != null and province != '' ">AND OBJ_AD_CODE LIKE CONCAT(#{province}, '%')</if>
- <if test="adCode != null and adCode != '' ">
- and OBJ_AD_CODE like '${adCode}%'
- </if>
- <if test="objType != null and objType != '' ">
- and PTYPE = #{objType}
- </if>
- <if test='sttm != null and sttm != "" '>
- and OBJ_INTM >= STR_TO_DATE(#{sttm},'%Y-%m-%d')
- </if>
- <if test='entm != null and entm != "" '>
- and OBJ_INTM < date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
- </if>
- </where>
- ) O
- RIGHT JOIN (
- <foreach collection="rgsterTable" index="index" item="item">
- <if test="index != 0">
- UNION ALL
- </if>
- <choose>
- <when test="item == 'BIS_INSP_GRW' ">
- SELECT OBJ_ID, INSP_STATE AS "STATE" FROM BIS_INSP_GRW WHERE INSP_STATE = '2'
- </when>
- <otherwise>
- SELECT OBJ_ID, STATE FROM ${item} WHERE STATE = '2'
- </otherwise>
- </choose>
- </foreach>
- ) R ON R.OBJ_ID = o.OBJ_ID
- </select>
- <select id="getObjTypeSizeMonth" resultType="java.util.Map">
- select ifnull(count(DISTINCT PTYPE), 0) OBJTYPESIZEMONTH
- from BIS_INSP_ALL_OBJ
- where
- OBJ_INTM between DATE_ADD(now(),INTERVAL -1 MONTH) and now()
- <if test="orgId != null and orgId != '' ">
- AND ORG_ID = #{orgId}
- </if>
- <if test="adCode != null and adCode != ''">AND OBJ_AD_CODE LIKE '${adCode}%'</if>
- </select>
- <select id="getPblmSizeMonth" resultType="java.util.Map">
- SELECT
- ifnull(COUNT(A.PBLM_ID), 0) PBLMSIZEMONTH
- FROM
- BIS_INSP_PBLM A
- JOIN
- BIS_INSP_ALL_OBJ B ON A.OBJ_ID=B.OBJ_ID
- WHERE
- A.DATA_STAT= '0'
- AND A.coll_time between DATE_ADD(now(),INTERVAL -1 MONTH) and now()
- <if test="orgId != null and orgId != '' ">AND B.ID LIKE '___${orgId}%'</if>
- <if test="adCode != null and adCode != '' ">AND B.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
- </select>
- <select id="getDelPblmSizeMonth" resultType="java.util.Map">
- SELECT
- ifnull(COUNT(A.PBLM_ID), 0) PBLMLOGSIZEMONTH
- FROM BIS_INSP_PBLM_DEL_LOG A
- JOIN BIS_INSP_ALL_OBJ B ON A.OBJ_ID=B.OBJ_ID
- WHERE A.PBLM_DEL_TM between DATE_ADD(now(),INTERVAL -1 MONTH)and now()
- <if test="orgId != null and orgId != '' ">AND B.ID LIKE '___${orgId}%'</if>
- <if test="adCode != null and adCode != '' ">AND B.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
- </select>
- <select id="getObjSizeJicha" resultType="java.util.Map">
- SELECT
- ifnull(COUNT( DISTINCT r.id ), 0) OBJSIZE
- FROM TAC_INSP_YEAR_BATCH_OBJ O
- JOIN tac_pawp_rgstr r on o.ID = r.obj_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="adCode != null and adCode != ''">and r.AD_CODE LIKE '${adCode}%'</if>
- <if test="province != null and province != ''">and r.PROVINCE LIKE '${province}%'</if>
- </where>
- </select>
- <select id="getPblmSizeJicha" resultType="java.util.Map">
- /* WITH O AS (
- )*/
- SELECT
- IFNULL(SUM(PBLM_SIZE), 0) AS PBLMSIZE
- FROM
- (SELECT
- r.AD_CODE as OBJ_AD_CODE, '8' as "PTYPE", a.INTM as "OBJ_INTM", COUNT( a.ID )
- PBLM_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>
- </where>
- GROUP BY a.list_type, r.AD_CODE, A.INTM) b
- <where>
- <if test="adCode != null and adCode != ''">OBJ_AD_CODE LIKE '${adCode}%'</if>
- </where>
- </select>
- <select id="getPblmSizeJichaZg" resultType="java.util.Map">
- /* WITH O AS (
- )*/
- SELECT
- IFNULL(SUM(PBLM_SIZE), 0) AS MENDSIZE
- FROM
- (SELECT
- r.AD_CODE as OBJ_AD_CODE, '8' as "PTYPE", a.INTM as "OBJ_INTM", COUNT( a.ID )
- PBLM_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_MEND_INFO WHERE STEP_ID = #{lastStepId} and CRT_STATE='1') 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>
- </where>
- GROUP BY a.list_type, r.AD_CODE, A.INTM
- ) a
- <where>
- <if test="adCode != null and adCode != ''">OBJ_AD_CODE LIKE '${adCode}%'</if>
- </where>
- </select>
- <select id="getPblmSizeJichaFc" resultType="java.util.Map">
- /* WITH O AS (
- )*/
- SELECT
- IFNULL(SUM(PBLM_SIZE), 0) AS PBLMLOGSIZE
- FROM (
- SELECT
- IF('1'=a.LIST_TYPE,'前期与设计', IF('2'=a.LIST_TYPE,'建设管理', IF('3'=a.LIST_TYPE,'计划下达与执行', IF('4'=a.LIST_TYPE,'资金使用与管理', IF('5'=a.LIST_TYPE,'工程质量管理-工程实体质量', IF('6'=a.LIST_TYPE,'安全管理', '' )))))) as NAME,
- r.AD_CODE as OBJ_AD_CODE, '8' as "PTYPE", a.INTM as "OBJ_INTM", COUNT( a.ID )
- PBLM_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_MEND_INFO WHERE STEP_ID = #{lastStepId} and pblm_out='1') 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>
- </where>
- GROUP BY a.list_type, r.AD_CODE, A.INTM
- ) z
- <where>
- <if test="adCode != null and adCode != ''">OBJ_AD_CODE LIKE '${adCode}%'</if>
- </where>
- </select>
- <select id="getHasObjSizeJicha" resultType="java.util.Map">
- SELECT ifnull(count(DISTINCT O.OBJ_ID),0) HASOBJSIZE
- FROM (
- SELECT * FROM BIS_INSP_ALL_OBJ
- <where>
- PTYPE = '8'
- <if test="adCode != null and adCode != '' ">
- and OBJ_AD_CODE like '${adCode}%'
- </if>
- </where>
- ) O
- LEFT JOIN (
- <foreach collection="rgsterTable" index="index" item="item">
- <if test="index != 0">
- UNION ALL
- </if>
- <choose>
- <when test="item == 'BIS_INSP_GRW' ">
- SELECT OBJ_ID, INSP_STATE AS "STATE" FROM BIS_INSP_GRW WHERE INSP_STATE = '2'
- </when>
- <otherwise>
- SELECT OBJ_ID, STATE FROM ${item} WHERE STATE = '2'
- </otherwise>
- </choose>
- </foreach>
- ) r ON r.OBJ_ID = o.OBJ_ID
- </select>
- <select id="getBisInspAllSize" resultType="java.util.Map">
- select IFNULL(count(*),0) as BISINSPALLSIZE from BIS_INSP_ALL A
- 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>
- )) T ON substr(A.ID,1,3) = T.CODE
- <where>
- LENGTH(A.ID) = 9
- <if test="orgId != null and orgId != '' ">AND A.ID LIKE '___${orgId}%'</if>
- <if test="province != null and province != '' ">AND A.PROVINCE LIKE CONCAT(#{province}, '%')</if>
- <if test="objType != null and objType != '' ">and A.ID LIKE concat(#{objType},'%') </if>
- <if test="sttm != null and sttm != '' ">and A.STTM >= str_to_date(#{sttm}, '%Y-%m-%d')</if>
- <if test="entm != null and entm != '' ">and A.INTM < date_add( str_to_date(#{entm},'%Y-%m-%d'), INTERVAL 1 day )</if>
- </where>
- </select>
- <select id="getBisInspAllGroupSize" resultType="java.util.Map">
- SELECT ifnull(COUNT(DISTINCT C.ID),0) BISINSPALLGROUPSIZE
- FROM BIS_INSP_ALL C
- 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>
- )) T ON SUBSTR(C.ID, 1, 3) = T.CODE
- LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
- WHERE LENGTH(C.ID) = '12'
- <if test="adCode != null and adCode != ''">AND O.OBJ_AD_CODE LIKE '${adCode}%'</if>
- <if test="orgId != null and orgId != '' ">
- AND C.ID LIKE '___${orgId}%'
- </if>
- <if test="objType != null and objType != '' ">
- and cast(C.ID as signed ) LIKE '${objType}%'
- </if>
- <if test='sttm != null and sttm != "" '>
- and C.STTM >= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
- </if>
- <if test='entm != null and entm != "" '>
- and C.STTM < date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
- </if>
- </select>
- <select id="getBisInspAllGroupSizeJicha" resultType="java.util.Map">
- SELECT ifnull(COUNT(*),0) GROUPSIZE
- FROM TAC_INSP_YEAR_BATCH_GROUP g
- where exists (select *
- from TAC_INSP_YEAR_BATCH y
- JOIN TAC_INSP_YEAR_BATCH_AREA aa ON aa.YEAR_BATCH_ID = y.ID
- where y.id = g.year_batch_id
- <if test="year != null and year != ''">and y.YEAR = #{year}</if>
- <if test="batch != null and batch != ''">and y.BATCH = #{batch}</if>
- <if test="adCode != null and adCode != ''">and aa.AD_CODE LIKE '${adCode}%'</if>
- <if test="province != null and province != ''">and y.PROVINCE LIKE '${province}%'</if>
- )
- </select>
- <select id="getBisInspAllSizeMonth" resultType="java.util.Map">
- SELECT ifnull(COUNT(distinct C.ID),0) BISINSPALLSIZEMONTH
- FROM BIS_INSP_ALL C
- LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
- WHERE LENGTH(C.ID) = '9'
- and C.INTM between DATE_ADD(now(),INTERVAL -1 MONTH) and now()
- <if test="orgId != null and orgId != '' ">
- AND C.ID LIKE '___${orgId}%'
- </if>
- <if test="adCode != null and adCode != ''">AND O.OBJ_AD_CODE LIKE '${adCode}%'</if>
- </select>
- <!-- 统计 全部人员数量 -->
- <select id="getAllPerSize" resultType="java.util.Map">
- select ifnull( count( DISTINCT rp.guid) ,0) as PERSIZEALL
- FROM BIS_INSP_ALL_RLATION_PERS rp ,
- Bis_Insp_Pers_Org g,
- bis_insp_org o
- WHERE rp.guid = g.pers_id and
- g.org_id = o.org_id
- <if test='orgId != null and orgId != "" '>
- AND o.ORG_ID = #{orgId}
- </if>
- <if test='adCode != null and adCode != "" '>
- AND o.ad_code LIKE CONCAT(#{adCode}, '%' )
- </if>
- </select>
- <select id="getBisInspAllRlationPerSize" resultType="java.util.Map">
- SELECT ifnull(COUNT(DISTINCT B.PERSID),0) PERSIZE
- FROM BIS_INSP_ALL_RLATION B
- JOIN BIS_INSP_ALL C ON B.ID = C.ID
- JOIN BIS_INSP_ALL_RLATION_PERS P ON P.GUID = B.PERSID
- 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>
- )) T ON SUBSTR(C.ID, 1, 3) = T.CODE
- LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
- <where>
- LENGTH( C.ID ) = 12
- <if test="adCode != null and adCode != ''">AND O.OBJ_AD_CODE LIKE '${adCode}%'</if>
- <if test="orgId != null and orgId != '' ">
- AND C.ID LIKE '___${orgId}%'
- </if>
- <if test="objType != null and objType != '' ">
- and cast(C.ID as signed) LIKE '${objType}%'
- </if>
- <if test='sttm != null and sttm != "" '>
- and C.STTM >= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
- </if>
- <if test='entm != null and entm != "" '>
- and C.INTM < date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
- </if>
- </where>
- </select>
- <select id="getBisInspAllRlationPerNumSize" resultType="java.util.Map">
- SELECT ifnull(COUNT(B.PERSID),0) PERNUMSIZE
- FROM BIS_INSP_ALL_RLATION B
- JOIN BIS_INSP_ALL C ON B.ID = C.ID
- JOIN BIS_INSP_ALL_RLATION_PERS P ON P.GUID = B.PERSID
- 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>
- )) T ON SUBSTR(C.ID, 1, 3) = T.CODE
- LEFT JOIN BIS_INSP_ALL_OBJ O ON O.ID = C.ID
- <where>
- LENGTH( C.ID ) = 12
- <if test="adCode != null and adCode != ''">AND O.OBJ_AD_CODE LIKE '${adCode}%'</if>
- <if test="orgId != null and orgId != '' ">
- AND C.ID LIKE '___${orgId}%'
- </if>
- <if test="objType != null and objType != '' ">
- and cast(C.ID as signed) LIKE '${objType}%'
- </if>
- <if test='sttm != null and sttm != "" '>
- and C.STTM >= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
- </if>
- <if test='entm != null and entm != "" '>
- and C.INTM < date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
- </if>
- </where>
- </select>
- <select id="getBisInspAllRlationPerSizeJicha" resultType="java.util.Map">
- SELECT ifnull(COUNT(*),0) PERSIZE
- FROM TAC_INSP_YEAR_BATCH_GROUP_PERS P
- where exists (select *
- from TAC_INSP_YEAR_BATCH y
- JOIN TAC_INSP_YEAR_BATCH_AREA aa ON aa.YEAR_BATCH_ID = y.ID
- where y.id = p.year_batch_id
- <if test="year != null and year != ''">and y.YEAR = #{year}</if>
- <if test="batch != null and batch != ''">and y.BATCH = #{batch}</if>
- <if test="adCode != null and adCode != ''">and aa.AD_CODE LIKE '${adCode}%'</if>
- <if test="province != null and province != ''">and y.PROVINCE LIKE '${province}%'</if>
- )
- AND GROUP_ID IS NOT NULL
- AND GROUP_NM IS NOT NULL
- </select>
- <select id="statisticsBySpecialtyType" resultType="java.util.Map">
- WITH O AS (
- <choose>
- <when test='objType == "8" '>
- SELECT
- (
- CASE WHEN a.LIST_TYPE = '1' THEN '前期与设计'
- WHEN a.LIST_TYPE = '2' THEN '建设管理'
- WHEN a.LIST_TYPE = '3' THEN '计划下达与执行'
- WHEN a.LIST_TYPE = '4' THEN '资金使用与管理'
- WHEN a.LIST_TYPE = '5' THEN '工程质量'
- WHEN a.LIST_TYPE = '6' THEN '工程安全'
- else ''
- end
- )as NAME, r.AD_CODE as OBJ_AD_CODE, a.LIST_TYPE as "PTYPE", a.INTM as "OBJ_INTM", COUNT(
- a.ID ) PBLM_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>
- </where>
- GROUP BY a.list_type, r.AD_CODE, A.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 OBJ_AD_CODE ,
- O.PTYPE,
- (CASE WHEN P.COLL_TIME IS NULL THEN O.OBJ_INTM ELSE P.COLL_TIME END) AS "OBJ_INTM",
- COUNT( P.PBLM_ID ) PBLM_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
- JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
- <where>
- <if test="orgId != null and orgId != '' ">AND O.ID LIKE '___${orgId}%'</if>
- <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</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, (CASE WHEN P.COLL_TIME IS NULL THEN O.OBJ_INTM ELSE P.COLL_TIME END)
- </otherwise>
- </choose>
- )
- SELECT
- PTYPE, NAME, SUM(PBLM_SIZE) AS "VALUE"
- FROM O
- WHERE name is not null
- <if test="adCode != null and adCode != ''">and OBJ_AD_CODE LIKE '${adCode}%'</if>
- GROUP BY PTYPE, NAME
- ORDER BY cast(PTYPE as unsigned)
- </select>
- <!-- 福建省督查首页 统计 督查类型 查询 -->
- <select id="statisticsFjIndexBySpecialtyType" resultType="java.util.Map">
- WITH O AS (
- 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 OBJ_AD_CODE ,
- O.PTYPE,
- COUNT( P.PBLM_ID ) PBLM_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
- JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
- <where>
- <if test="orgId != null and orgId != '' ">AND O.ID LIKE '___${orgId}%'</if>
- <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</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
- PTYPE, NAME
- FROM O
- WHERE name is not null
- <if test="adCode != null and adCode != ''">and OBJ_AD_CODE LIKE '${adCode}%'</if>
- GROUP BY PTYPE, NAME
- ORDER BY cast(PTYPE as unsigned)
- </select>
- <!-- 福建省首页 按 督查类别 问题类别进行 统计 -->
- <select id="statisticsByPblmType" resultType="java.util.Map">
- SELECT
- PTYPE, NAME, PBLMNAME, SUM(PBLM_SIZE) AS "VALUE"
- FROM (
- 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 OBJ_AD_CODE ,
- O.PTYPE,
- (CASE WHEN P.COLL_TIME IS NULL THEN O.OBJ_INTM ELSE P.COLL_TIME END) AS "OBJ_INTM",
- COUNT(P.PBLM_ID ) PBLM_SIZE,
- (CASE WHEN P.PBLM_NAME_BZ IS NULL THEN P.INSP_PBLM_NAME ELSE P.PBLM_NAME_BZ END) AS "PBLMNAME"
- 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
- JOIN BIS_INSP_PBLM P ON P.OBJ_ID = O.OBJ_ID
- <where>
- <if test="orgId != null and orgId != '' ">AND O.ID LIKE '___${orgId}%'</if>
- <if test="objType != null and objType != ''">and O.PTYPE = #{objType}</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,
- (CASE WHEN P.COLL_TIME IS NULL THEN O.OBJ_INTM ELSE P.COLL_TIME END),
- (CASE WHEN P.PBLM_NAME_BZ IS NULL THEN P.INSP_PBLM_NAME ELSE P.PBLM_NAME_BZ END)
- ) O
- WHERE name is not null
- <if test="adCode != null and adCode != ''">and OBJ_AD_CODE LIKE '${adCode}%'</if>
- GROUP BY PTYPE, NAME, PBLMNAME
- ORDER BY cast(PTYPE as unsigned)
- </select>
- <!-- 福建省督查首页 统计年度的批次 组数 每年1条记录 -->
- <select id="selectBatchAndGroupSize" resultType="java.util.Map">
- SELECT IFNULL(yi.YEAR_BATH,0) AS "YEARBATHSIZE", IFNULL(yi.YEAR_GROUP,0) AS "YEARGROUPSIZE"
- FROM (select cast(#{year} as unsigned) as YEAR from dual ) y
- LEFT JOIN (
- select * from BIS_INSP_YEAR_INFO
- <where>
- <if test="year != null and year != ''">and YEAR = cast(#{year} as unsigned) </if>
- <if test="batch != null and batch != ''">and YEAR_BATH = cast(#{batch} as unsigned) </if>
- <if test="adCode != null and adCode != '' ">AND AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
- </where>
- ) yi ON yi.YEAR = y.YEAR
- </select>
- <select id="statisticsByEngType" resultType="java.util.Map">
- /*WITH O AS (
- )
- */
- SELECT
- NAME, SUM(PBLM_SIZE) AS "VALUE"
- FROM ( SELECT B.TYPE AS "NAME",
- R.AD_CODE AS OBJ_AD_CODE,
- A.INTM AS "OBJ_INTM",
- ifnull(COUNT(A.ID),0) PBLM_SIZE
- FROM TAC_INSP_YEAR_BATCH_OBJ O
- LEFT JOIN TAC_ATT_PAWP_BASE B ON B.ID = O.OJB_ID
- LEFT JOIN TAC_PAWP_RGSTR R ON O.ID = R.OBJ_ID
- LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_INFO) 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>
- </where>
- GROUP BY B.TYPE, r.AD_CODE, A.INTM) O
- WHERE name is not null
- <if test="adCode != null and adCode != ''">and OBJ_AD_CODE LIKE '${adCode}%'</if>
- <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
- and OBJ_INTM >= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
- and OBJ_INTM < date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
- </if>
- GROUP BY NAME
- ORDER BY NAME
- </select>
- <select id="statisticsByResubType" resultType="java.util.Map">
- /* WITH O AS (
- )*/
- SELECT
- PTYPE, NAME, SUM(PBLM_SIZE) AS "VALUE"
- FROM (SELECT
- PS.SYS_TYPE AS "PTYPE",
- PS.SYS_NAME AS "NAME",
- R.AD_CODE AS OBJ_AD_CODE,
- A.INTM AS "OBJ_INTM",
- ifnull(COUNT(A.ID),0) PBLM_SIZE
- FROM TAC_INSP_YEAR_BATCH_OBJ O
- LEFT JOIN TAC_ATT_PAWP_BASE B ON B.ID = O.OJB_ID
- LEFT JOIN TAC_PAWP_RGSTR R ON O.ID = R.OBJ_ID
- LEFT JOIN (SELECT * FROM TAC_PROVINCE_PBLM_INFO) A ON A.RGSTR_ID = R.ID
- LEFT JOIN (
- SELECT PS.PBLM_ID,
- IF('101'=OS.SYS_TYPE,'100', OS.SYS_TYPE ) SYS_TYPE,
- IF('-'=OS.SYS_NAME,'其他', IF(null =OS.SYS_NAME,'其他', OS.SYS_NAME ) ) SYS_NAME
- FROM TAC_PBLM_SUBJECT PS
- JOIN TAC_OBJ_SUBJECT OS ON PS.SUB_ID = OS.ID
- ) PS ON PS.PBLM_ID = A.ID
- <where>
- <if test="year != null and year != ''">and O.YEAR = #{year}</if>
- <if test="batch != null and batch != ''">and O.BATCH = #{batch}</if>
- </where>
- GROUP BY PS.SYS_TYPE,PS.SYS_NAME, R.AD_CODE, A.INTM) O
- WHERE name is not null
- <if test="adCode != null and adCode != ''">and OBJ_AD_CODE LIKE '${adCode}%'</if>
- <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
- and OBJ_INTM >= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
- and OBJ_INTM < DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
- </if>
- GROUP BY PTYPE, NAME
- ORDER BY cast(PTYPE as unsigned)
- </select>
- <select id="personCount" resultType="java.util.Map">
- select TYPE, GROUP_NAME, count(PERSID) AS VALUE
- from (
- select
- T.NAME AS TYPE, concat(ifnull(BIA.PNM,'') ,'(', ifnull(PBIA.PNM,''),')') AS GROUP_NAME, T.CODE, BIA.ID, R.PERSID
- from ATT_INSP_TYPE T
- join BIS_INSP_ALL BIA on T.CODE = substr(BIA.ID, 1, 3)
- left join BIS_INSP_ALL_RLATION R on R.ID = BIA.ID
- left join BIS_INSP_ALL PBIA on PBIA.ID = BIA.PID
- where length(BIA.ID) = 12
- <if test="orgId != null and orgId != ''">and BIA.ID like '___${orgId}%'</if>
- <if test="objType != null and objType != ''">and BIA.ID like '${objType}%'</if>
- <if test='sttm != null and sttm != "" and entm != null and entm != "" '>
- and BIA.INTM >= STR_TO_DATE(#{sttm}, '%Y-%m-%d')
- and BIA.INTM < date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )
- </if>
- )
- group by CODE ,TYPE, ID, GROUP_NAME
- ORDER BY CODE, ID
- </select>
- <select id="getZgSize" resultType="java.util.Map">
- select ifnull(count(pl.id),0) AS "MENDSIZE"
- <!-- 不统计非系统来源整改数 add lxf 2022/11/19 系统来源 数量-->
- ,ifnull(count( case when pl.PBLM_ID is not null then pl.PBLM_ID end ),0) as "MENDSIZESYS"
- ,ifnull(count( case when pl.PBLM_ID is null then pl.PBLM_ID end ),0) as "MENDSIZENO"
- from BIS_INSP_PBLM_PLIST pl
- LEFT JOIN BIS_INSP_PBLM P ON P.PBLM_ID = pl.PBLM_ID
- left join BIS_INSP_ALL_OBJ O ON P.OBJ_ID = O.OBJ_ID
- 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
- where pl.DATA_STAT='0'
- and (
- pl.PERS_ID = #{persId}
- OR pl.pblm_classify in (select pblm_classify from bis_insp_pblm_mend_pri where MAND_PERS_ID =#{persId} and
- DATA_STAT='0')
- )
- <if test="province != null and province != '' ">AND pl.OBJ_AD_CODE LIKE CONCAT(#{province}, '%')</if>
- <if test="adCode != null and adCode != '' ">and pl.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
- <if test="objType != null and objType != '' ">and pl.OBJ_TYPE = #{objType}</if>
- <if test='sttm != null and sttm != "" '>and O.OBJ_INTM >= STR_TO_DATE(#{sttm}, '%Y-%m-%d') </if>
- <if test='entm != null and entm != "" '>and O.OBJ_INTM < DATE_ADD( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day ) </if>
- </select>
- <select id="getPdZgSize" resultType="java.util.Map">
- select ifnull(count(pl.id),0) AS "PBLMLOGSIZE"
- from BIS_INSP_PBLM_PLIST pl
- LEFT JOIN BIS_INSP_PBLM P ON P.PBLM_ID = pl.PBLM_ID
- left join BIS_INSP_ALL_OBJ O ON P.OBJ_ID = O.OBJ_ID
- 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
- where pl.DATA_STAT='0'
- AND pl.PBLM_OUT = '1'
- and (
- pl.PERS_ID = #{persId}
- OR pl.pblm_classify in (select pblm_classify from bis_insp_pblm_mend_pri where MAND_PERS_ID =#{persId} and
- DATA_STAT='0')
- )
- <if test="province != null and province != '' ">AND pl.OBJ_AD_CODE LIKE CONCAT(#{province}, '%')</if>
- <if test="adCode != null and adCode != '' ">and pl.OBJ_AD_CODE LIKE CONCAT(#{adCode}, '%')</if>
- <if test="objType != null and objType != '' ">and pl.OBJ_TYPE = #{objType}</if>
- <if test='sttm != null and sttm != "" '>and O.OBJ_INTM >= STR_TO_DATE(#{sttm}, '%Y-%m-%d')</if>
- <if test='entm != null and entm != "" '>and O.OBJ_INTM < date_add( STR_TO_DATE(#{entm},'%Y-%m-%d'), INTERVAL 1 day )</if>
- </select>
- </mapper>
|