| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- <?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.BisInspPlanDtlDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspPlanDtl" id="bisInspPlanDtlResultMap">
- <result property="id" column="ID"/>
- <result property="planId" column="PLAN_ID"/>
- <result property="stTm" column="ST_TM"/>
- <result property="enTm" column="EN_TM"/>
- <result property="chkPrjSize" column="CHK_PRJ_SIZE"/>
- <result property="chkType" column="CHK_TYPE"/>
- <result property="onlineChk" column="ONLINE_CHK"/>
- <result property="note" column="NOTE"/>
- <result property="persId" column="PERS_ID"/>
- <result property="intm" column="INTM"/>
- <result property="uptm" column="UPTM"/>
- <result property="dataStat" column="DATA_STAT"/>
- <result property="nm" column="NM"/>
- <result property="ddAdCode" column="DD_AD_CODE"/>
- <result property="chkContent" column="CHK_CONTENT"/>
- <result property="chkImplDept" column="CHK_IMPL_DEPT"/>
- </resultMap>
- <sql id="table_columns">
- ID,
- NM,
- PLAN_ID,
- ST_TM,
- EN_TM,
- CHK_PRJ_SIZE,
- CHK_TYPE,
- ONLINE_CHK,
- NOTE,
- PERS_ID,
- INTM,
- UPTM,
- DATA_STAT,
- CHK_CONTENT,
- CHK_IMPL_DEPT
- </sql>
- <sql id="entity_properties">
- #{id},
- #{nm},
- #{planId},
- #{stTm},
- #{enTm},
- #{chkPrjSize},
- #{chkType},
- #{onlineChk},
- #{note},
- #{persId},
- #{intm},
- #{uptm},
- #{dataStat},
- #{chkContent},
- #{chkImplDept}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="planId != null and planId != ''">
- and plan_id in (select plan_id
- from bis_insp_plandp_rl
- where plan_dp_id = #{planId}
- union all
- select id
- from bis_insp_plan_year
- where lead_dep_id = #{planId})
- </if>
- <if test="stTm != null">and ST_TM = #{stTm}</if>
- <if test="enTm != null">and EN_TM = #{enTm}</if>
- <if test="chkPrjSize != null">and CHK_PRJ_SIZE = #{chkPrjSize}</if>
- <if test="chkType != null and chkType != ''">and CHK_TYPE = #{chkType}</if>
- <if test="onlineChk != null and onlineChk != ''">and ONLINE_CHK = #{onlineChk}</if>
- <if test="note != null and note != ''">and NOTE = #{note}</if>
- <if test="persId != null and persId != ''">and PERS_ID = #{persId}</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>
- <if test="yearStr != null and yearStr != ''">
- <choose>
- <when test="monthStr != null and monthStr != ''">
- and (to_char(ST_TM, 'yyyy-MM') = (#{yearStr} || '-' || #{monthStr})
- or to_char(EN_TM, 'yyyy-MM') = (#{yearStr} || '-' || #{monthStr}) )
- </when>
- <otherwise>
- and (to_char(ST_TM, 'yyyy') = #{yearStr} or to_char(EN_TM, 'yyyy') = #{yearStr})
- </otherwise>
- </choose>
- </if>
- <if test=' null != nm and "" != nm '>and NM like '${nm}%'</if>
- <!-- 检查内容、开展检查实施处室(单位) add lxf 2022/10/25 -->
- <if test='null != chkContent and "" != chkContent '>and CHK_CONTENT like '${chkContent}%'</if>
- and DATA_STAT='0'
- </trim>
- </sql>
- <select id="get" resultMap="bisInspPlanDtlResultMap" parameterType="String">
- select
- <include refid="table_columns"/>
- from BIS_INSP_PLAN_DTL where ID = #{id}
- </select>
- <select id="getBy" resultMap="bisInspPlanDtlResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_PLAN_DTL
- <include refid="page_where"/>
- </select>
- <select id="findAll" resultMap="bisInspPlanDtlResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_PLAN_DTL
- </select>
- <select id="findList" resultMap="bisInspPlanDtlResultMap">
- select
- <include refid="table_columns"/>
- from BIS_INSP_PLAN_DTL
- <include refid="page_where"/>
- </select>
- <select id="selectCount" resultType="int">
- select count(ID) from BIS_INSP_PLAN_DTL
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanDtl">
- insert into BIS_INSP_PLAN_DTL(
- <include refid="table_columns"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- update BIS_INSP_PLAN_DTL
- set DATA_STAT='9'
- where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanDtl">
- update BIS_INSP_PLAN_DTL set DATA_STAT='9'
- <include refid="page_where"/>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update BIS_INSP_PLAN_DTL
- set DATA_STAT = '9'
- where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanDtl">
- update BIS_INSP_PLAN_DTL
- <trim prefix="set" suffixOverrides=",">
- <if test="planId != null and planId != ''">PLAN_ID = #{planId},</if>
- <if test="stTm != null">ST_TM = #{stTm},</if>
- <if test="enTm != null">EN_TM = #{enTm},</if>
- <if test="chkPrjSize != null">CHK_PRJ_SIZE = #{chkPrjSize},</if>
- <if test="chkType != null and chkType != ''">CHK_TYPE = #{chkType},</if>
- <if test="onlineChk != null and onlineChk != ''">ONLINE_CHK = #{onlineChk},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</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>
- <if test="nm != null and nm != ''">NM = #{nm},</if>
- <if test='chkContent != null and "" != chkContent ' >CHK_CONTENT = #{chkContent},</if>
- <if test='chkImplDept != null and "" != chkImplDept ' >CHK_IMPL_DEPT = #{chkImplDept},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanDtl">
- update BIS_INSP_PLAN_DTL
- <trim prefix="set" suffixOverrides=",">
- <if test="planId != null and planId != ''">PLAN_ID = #{planId},</if>
- <if test="stTm != null">ST_TM = #{stTm},</if>
- <if test="enTm != null">EN_TM = #{enTm},</if>
- <if test="chkPrjSize != null">CHK_PRJ_SIZE = #{chkPrjSize},</if>
- <if test="chkType != null and chkType != ''">CHK_TYPE = #{chkType},</if>
- <if test="onlineChk != null and onlineChk != ''">ONLINE_CHK = #{onlineChk},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</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>
- <if test="nm != null and nm != ''">NM = #{nm},</if>
- <if test='chkContent != null and "" != chkContent ' >CHK_CONTENT = #{chkContent},</if>
- <if test='chkImplDept != null and "" != chkImplDept ' >CHK_IMPL_DEPT = #{chkImplDept},</if>
- </trim>
- <include refid="page_where"/>
- </update>
- <!-- 其他自定义SQL -->
- <select id="findDtlList" resultType="cn.com.goldenwater.dcproj.dto.BisInspPlanDtlDto">
- select
- BIPD.ID,
- BIPD.NM,
- BIPD.PLAN_ID,
- BIPD.ST_TM,
- BIPD.EN_TM,
- BIPD.CHK_PRJ_SIZE,
- BIPD.CHK_TYPE,
- BIPD.ONLINE_CHK,
- BIPD.NOTE,
- BIPD.PERS_ID,
- BIPD.INTM,
- BIPD.UPTM,
- BIPD.DATA_STAT,
- BIPD.CHK_CONTENT,
- BIPD.CHK_IMPL_DEPT,
- BIPY.CHK_NAME,
- BIPY.STATE,
- BIPY.AD_CODE as DD_AD_CODE,
- BIPY.CHK_YEAR,
- DP.DP_NAME
- from BIS_INSP_PLAN_DTL BIPD
- left join BIS_INSP_PLAN_YEAR BIPY on BIPY.ID = BIPD.PLAN_ID
- left join BIS_INSP_PLAN_DP DP ON DP.ID = BIPY.LEAD_DEP_ID
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="planId != null and planId != ''">
- and BIPY.ID = #{planId}
- </if>
- <if test="stTm != null">and BIPD.ST_TM = #{stTm}</if>
- <if test="enTm != null">and BIPD.EN_TM = #{enTm}</if>
- <if test="chkPrjSize != null">and BIPD.CHK_PRJ_SIZE = #{chkPrjSize}</if>
- <if test="chkType != null and chkType != ''">and BIPD.CHK_TYPE = #{chkType}</if>
- <if test="onlineChk != null and onlineChk != ''">and BIPD.ONLINE_CHK = #{onlineChk}</if>
- <if test="note != null and note != ''">and BIPD.NOTE = #{note}</if>
- <if test="persId != null and persId != ''">and BIPD.PERS_ID = #{persId}</if>
- <if test="intm != null">and BIPD.INTM = #{intm}</if>
- <if test="uptm != null">and BIPD.UPTM = #{uptm}</if>
- <if test="dataStat != null and dataStat != ''">and BIPD.DATA_STAT = #{dataStat}</if>
- <if test="nm != null and nm != ''">and BIPD.NM like '%${nm}%'</if>
- <if test="ddAdCode != null and ddAdCode != ''">and BIPY.AD_CODE LIKE '${ddAdCode}%'</if>
- <if test="chkYear != null and chkYear != ''">and BIPY.CHK_YEAR = #{chkYear}</if>
- <if test="yearStr != null and yearStr != ''">
- <choose>
- <when test='monthStr != null and monthStr != "" '>
- and (to_char(BIPD.ST_TM, 'yyyy-MM') = (#{yearStr} || '-' || #{monthStr})
- or to_char(BIPD.EN_TM, 'yyyy-MM') = (#{yearStr} || '-' || #{monthStr}) )
- </when>
- <otherwise>
- and (to_char(BIPD.ST_TM, 'yyyy') = #{yearStr} or to_char(BIPD.EN_TM, 'yyyy') = #{yearStr})
- </otherwise>
- </choose>
- </if>
- <if test="planDpId != null and planDpId !=''">
- AND (BIPY.ID IN (SELECT DISTINCT PLAN_ID FROM BIS_INSP_PLANDP_RL WHERE PLAN_DP_ID = #{planDpId})
- OR BIPY.LEAD_DEP_ID = #{planDpId})
- </if>
- <if test='chkContent != null and "" != chkContent ' >CHK_CONTENT like '%${chkContent}%' ,</if>
- and BIPD.DATA_STAT='0'
- </trim>
- </select>
- </mapper>
|