| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- <?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.TaskItemDayDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.TaskItemDay" id="taskItemDayResultMap">
- <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="itemName" column="ITEM_NAME"/>
- <result property="itemCode" column="ITEM_CODE"/>
- <result property="mendSize" column="MEND_SIZE"/>
- <result property="pblmLogSize" column="PBLM_LOG_SIZE"/>
- <result property="pblmSize" column="PBLM_SIZE"/>
- <result property="infoPlbm" column="INFO_PLBM"/>
- <result property="warmPlbm" column="WARM_PLBM"/>
- <result property="errorPlbm" column="ERROR_PLBM"/>
- <result property="intm" column="INTM"/>
- <result property="uptm" column="UPTM"/>
- <result property="dataStat" column="DATA_STAT"/>
- </resultMap>
- <sql id="table_columns">
- INFO_PLBM,
- WARM_PLBM,
- ERROR_PLBM,
- ID,
- ORG_ID,
- AD_CODE,
- AD_NAME,
- AD_FULL_NAME,
- AD_GRAD,
- TM,
- OBJ_TYPE,
- OBJ_NAME,
- ITEM_NAME,
- ITEM_CODE,
- MEND_SIZE,
- PBLM_LOG_SIZE,
- PBLM_SIZE,
- INTM,
- UPTM,
- DATA_STAT
- </sql>
- <sql id="entity_properties">
- #{infoPlbm},
- #{warmPlbm},
- #{errorPlbm},
- #{id},
- #{orgId},
- #{adCode},
- #{adName},
- #{adFullName},
- #{adGrad},
- #{tm},
- #{objType},
- #{objName},
- #{itemName},
- #{itemCode},
- #{mendSize},
- #{pblmLogSize},
- #{pblmSize},
- #{intm},
- #{uptm},
- #{dataStat}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="warmPlbm != null and warmPlbm != ''">and WARM_PLBM = #{warmPlbm}</if>
- <if test="errorPlbm != null and errorPlbm != ''">and ERROR_PLBM = #{errorPlbm}</if>
- <if test="infoPlbm != null and infoPlbm != ''">and INFO_PLBM = #{infoPlbm}</if>
- <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="itemName != null and itemName != ''">and ITEM_NAME = #{itemName}</if>
- <if test="itemCode != null and itemCode != ''">and ITEM_CODE = #{itemCode}</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="pblmSize != null and pblmSize != ''">and PBLM_SIZE = #{pblmSize}</if>
- <if test="intm != null">and INTM = #{intm}</if>
- <if test="uptm != null">and UPTM = #{uptm}</if>
- and DATA_STAT='0'
- </trim>
- </sql>
- <select id="get" resultMap="taskItemDayResultMap" parameterType="String">
- select
- <include refid="table_columns"/>
- from GW_SYS_TASK_ITEM_DAY where ID = #{id}
- </select>
- <select id="getBy" resultMap="taskItemDayResultMap">
- select
- <include refid="table_columns"/>
- from GW_SYS_TASK_ITEM_DAY
- <include refid="page_where"/>
- </select>
- <select id="findAll" resultMap="taskItemDayResultMap">
- select
- <include refid="table_columns"/>
- from GW_SYS_TASK_ITEM_DAY
- </select>
- <select id="findList" resultMap="taskItemDayResultMap">
- select
- <include refid="table_columns"/>
- from GW_SYS_TASK_ITEM_DAY
- <include refid="page_where"/>
- </select>
- <select id="selectCount" resultType="int">
- select count(ID) from GW_SYS_TASK_ITEM_DAY
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TaskItemDay">
- insert into GW_SYS_TASK_ITEM_DAY(
- <include refid="table_columns"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- update GW_SYS_TASK_ITEM_DAY set DATA_STAT='9' where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TaskItemDay">
- update GW_SYS_TASK_ITEM_DAY set DATA_STAT='9'
- <include refid="page_where"/>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update GW_SYS_TASK_ITEM_DAY set DATA_STAT = '9' where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TaskItemDay">
- update GW_SYS_TASK_ITEM_DAY
- <trim prefix="set" suffixOverrides=",">
- <if test="warmPlbm != null and warmPlbm != ''">WARM_PLBM = #{warmPlbm},</if>
- <if test="errorPlbm != null and errorPlbm != ''">ERROR_PLBM = #{errorPlbm},</if>
- <if test="infoPlbm != null and infoPlbm != ''">INFO_PLBM = #{infoPlbm},</if>
- <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="itemName != null and itemName != ''">ITEM_NAME = #{itemName},</if>
- <if test="itemCode != null and itemCode != ''">ITEM_CODE = #{itemCode},</if>
- <if test="mendSize != null and mendSize != ''">MEND_SIZE = #{mendSize},</if>
- <if test="pblmLogSize != null and pblmLogSize != ''">PBLM_LOG_SIZE = #{pblmLogSize},</if>
- <if test="pblmSize != null and pblmSize != ''">PBLM_SIZE = #{pblmSize},</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.TaskItemDay">
- update GW_SYS_TASK_ITEM_DAY
- <trim prefix="set" suffixOverrides=",">
- <if test="warmPlbm != null and warmPlbm != ''">WARM_PLBM = #{warmPlbm},</if>
- <if test="errorPlbm != null and errorPlbm != ''">ERROR_PLBM = #{errorPlbm},</if>
- <if test="infoPlbm != null and infoPlbm != ''">INFO_PLBM = #{infoPlbm},</if>
- <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="itemName != null and itemName != ''">ITEM_NAME = #{itemName},</if>
- <if test="itemCode != null and itemCode != ''">ITEM_CODE = #{itemCode},</if>
- <if test="mendSize != null and mendSize != ''">MEND_SIZE = #{mendSize},</if>
- <if test="pblmLogSize != null and pblmLogSize != ''">PBLM_LOG_SIZE = #{pblmLogSize},</if>
- <if test="pblmSize != null and pblmSize != ''">PBLM_SIZE = #{pblmSize},</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.TaskItemDay">-->
- <!-- SELECT-->
- <!-- A.AD_CODE, A.AD_NAME, A.LGTD, A.LTTD, T.ITEM_NAME,-->
- <!-- SUM(PBLM_SIZE) PBLM_SIZE, SUM(MEND_SIZE) MEND_SIZE,-->
- <!-- SUM(INFO_PLBM) INFO_PLBM, SUM(WARM_PLBM) WARM_PLBM, SUM(ERROR_PLBM) ERROR_PLBM,-->
- <!-- SUM(PBLM_LOG_SIZE) PBLM_LOG_SIZE-->
- <!-- FROM (SELECT * FROM ATT_AD_BASE WHERE AD_CODE LIKE '${province}%'-->
- <!-- <choose>-->
- <!-- <when test='adGrad == "4" '>-->
- <!-- AND AD_CODE = SUBSTR(AD_CODE, 0, 6) || '000000'-->
- <!-- </when>-->
- <!-- <otherwise>-->
- <!-- AND AD_CODE = SUBSTR(AD_CODE, 0, 4) || '00000000'-->
- <!-- </otherwise>-->
- <!-- </choose>-->
- <!-- and AD_CODE != SUBSTR(AD_CODE, 0, 2) || '0000000000') A-->
- <!-- LEFT JOIN (-->
- <!-- SELECT-->
- <!-- ID, ORG_ID,-->
- <!-- <choose>-->
- <!-- <when test='adGrad == "4" '>-->
- <!-- SUBSTR(AD_CODE, 0, 6) || '000000' AD_CODE,-->
- <!-- </when>-->
- <!-- <otherwise>-->
- <!-- SUBSTR(AD_CODE, 0, 4) || '00000000' AD_CODE,-->
- <!-- </otherwise>-->
- <!-- </choose> AD_FULL_NAME,-->
- <!-- TM, OBJ_TYPE, OBJ_NAME, ITEM_NAME, PBLM_SIZE, MEND_SIZE, PBLM_LOG_SIZE,-->
- <!-- INFO_PLBM, WARM_PLBM, ERROR_PLBM, DATA_STAT-->
- <!-- FROM GW_SYS_TASK_ITEM_DAY-->
- <!-- where-->
- <!-- DATA_STAT='0'-->
- <!-- and AD_CODE != SUBSTR(AD_CODE, 0, 2) || '0000000000'-->
- <!-- <if test="warmPlbm != null and warmPlbm != ''">and WARM_PLBM = #{warmPlbm}</if>-->
- <!-- <if test="errorPlbm != null and errorPlbm != ''">and ERROR_PLBM = #{errorPlbm}</if>-->
- <!-- <if test="infoPlbm != null and infoPlbm != ''">and INFO_PLBM = #{infoPlbm}</if>-->
- <!-- <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>-->
- <!-- <if test="adCode != null and adCode != ''">and AD_CODE LIKE '${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="tm != null">and TO_CHAR(TM, 'YYYY-MM-DD') = TO_CHAR(#{tm}, 'YYYY-MM-DD')</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="itemName != null and itemName != ''">and ITEM_NAME = #{itemName}</if>-->
- <!-- <if test="itemCode != null and itemCode != ''">and ITEM_CODE = #{itemCode}</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="pblmSize != null and pblmSize != ''">and PBLM_SIZE = #{pblmSize}</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 to_date(to_CHAR(TM, 'yyyy-MM-dd'), 'yyyy-MM-dd')-->
- <!-- between to_date(substr(#{sttm}, 0, 10), 'yyyy-MM-dd') and to_date(substr(#{entm}, 0, 10), 'yyyy-MM-dd')-->
- <!-- </if>-->
- <!-- ) T ON T.AD_CODE = A.AD_CODE-->
- <!-- <where>-->
- <!-- <if test="adGrad != null and adGrad != ''">and A.AD_GRAD = #{adGrad}</if>-->
- <!-- </where>-->
- <!-- GROUP BY A.AD_CODE, A.AD_NAME, A.LGTD, A.LTTD, T.ITEM_NAME-->
- <!-- ORDER BY A.AD_CODE, T.ITEM_NAME-->
- <!-- </select>-->
- <select id="findForCity" resultType="cn.com.goldenwater.dcproj.model.TaskItemDay">
- WITH O AS (
- SELECT
- OBJ_AD_CODE AS "AD_CODE",
- obj_type,
- coll_time AS "TM",
- A.INSP_PBLM_NAME AS "ITEM_NAME",
- COUNT(A.PBLM_ID) AS "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,
- SUM(CASE A.INSP_PBLM_CATE WHEN '3' THEN 1 ELSE 0 END) ERRORS_PLBM
- FROM BIS_INSP_PBLM A
- GROUP BY OBJ_AD_CODE, obj_type, coll_time, INSP_PBLM_NAME
- )
- SELECT
- A.AD_CODE, A.AD_NAME, A.LGTD, A.LTTD, T.ITEM_NAME,
- SUM(PBLM_SIZE) PBLM_SIZE, SUM(MEND_SIZE) MEND_SIZE,
- SUM(INFO_PLBM) INFO_PLBM, SUM(WARM_PLBM) WARM_PLBM, SUM(ERROR_PLBM) ERROR_PLBM,
- SUM(PBLM_LOG_SIZE) PBLM_LOG_SIZE
- FROM (SELECT * FROM ATT_AD_BASE WHERE AD_CODE LIKE '${adCode}%'
- <choose>
- <when test='adGrad == "4" '>
- AND AD_CODE = SUBSTR(AD_CODE, 0, 6) || '000000'
- </when>
- <otherwise>
- AND AD_CODE = SUBSTR(AD_CODE, 0, 4) || '00000000'
- </otherwise>
- </choose>
- <if test="adGrad != null and adGrad != ''">and AD_GRAD = #{adGrad}</if>
- ) A
- LEFT JOIN (
- SELECT
- <choose>
- <when test='adGrad == "4" '>
- SUBSTR(AD_CODE, 0, 6) || '000000' AD_CODE,
- </when>
- <otherwise>
- SUBSTR(AD_CODE, 0, 4) || '00000000' AD_CODE,
- </otherwise>
- </choose>
- TM, OBJ_TYPE, ITEM_NAME, PBLM_SIZE, MEND_SIZE, PBLM_LOG_SIZE,
- INFO_PLBM, WARM_PLBM, ERROR_PLBM, ERRORS_PLBM
- FROM o
- <where>
- <if test="adCode != null and adCode != ''">and AD_CODE LIKE '${adCode}%'</if>
- <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
- <if test="objType != null and objType != ''">and OBJ_TYPE = #{objType}</if>
- <if test="itemName != null and itemName != ''">and ITEM_NAME = #{itemName}</if>
- <if test="sttm != null and sttm != '' and entm != null and entm != '' ">
- and to_date(to_CHAR(TM, 'yyyy-MM-dd'), 'yyyy-MM-dd')
- between to_date(substr(#{sttm}, 0, 10), 'yyyy-MM-dd') and to_date(substr(#{entm}, 0, 10), 'yyyy-MM-dd')
- </if>
- </where>
- ) T ON T.AD_CODE = A.AD_CODE
- GROUP BY A.AD_CODE, A.AD_NAME, A.LGTD, A.LTTD, T.ITEM_NAME
- ORDER BY A.AD_CODE, T.ITEM_NAME
- </select>
- </mapper>
|