| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- <?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.BisInspPlanMonthDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.BisInspPlanMonth" id="bisInspPlanMonthResultMap">
- <result property="organDep" column="ORGAN_DEP"/>
- <result property="yearPlanId" column="YEAR_PLAN_ID"/>
- <result property="yearChkName" column="YEAR_CHK_NAME"/>
- <result property="yearChkType" column="YEAR_CHK_TYPE"/>
- <result property="ordr" column="ORDR"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="chkTitle" column="CHK_TITLE"/>
- <result property="chkMonth" column="CHK_MONTH"/>
- <result property="chkDep" column="CHK_DEP"/>
- <result property="chkGrp" column="CHK_GRP"/>
- <result property="planSttm" column="PLAN_STTM"/>
- <result property="planEntm" column="PLAN_ENTM"/>
- <result property="leadDep" column="LEAD_DEP"/>
- <result property="joinDep" column="JOIN_DEP"/>
- <result property="chkCity" column="CHK_CITY"/>
- <result property="chkCountry" column="CHK_COUNTRY"/>
- <result property="chkSize" column="CHK_SIZE"/>
- <result property="chkType" column="CHK_TYPE"/>
- <result property="chkPers" column="CHK_PERS"/>
- <result property="chkPersTel" column="CHK_PERS_TEL"/>
- <result property="chkNote" column="CHK_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="id" column="ID"/>
- <result property="chkCityCode" column="chk_city_code"/>
- <result property="chkCountryCode" column="chk_country_code"/>
- <!-- <collection property="area" javaType="java.util.ArrayList" ofType="cn.com.goldenwater.dcproj.model.BisInspPlanMonthArea">-->
- <!-- <result property="adCode" column="area_ad_code"/>-->
- <!-- <result property="adName" column="area_ad_name"/>-->
- <!-- <result property="adGrad" column="area_ad_grad"/>-->
- <!-- </collection>-->
- </resultMap>
-
- <sql id="table_columns">
- ORDR,
- AD_CODE,
- CHK_TITLE,
- CHK_MONTH,
- CHK_DEP,
- CHK_GRP,
- PLAN_STTM,
- PLAN_ENTM,
- LEAD_DEP,
- JOIN_DEP,
- <!-- CHK_CITY,-->
- <!-- CHK_COUNTRY,-->
- CHK_SIZE,
- CHK_TYPE,
- CHK_PERS,
- CHK_PERS_TEL,
- CHK_NOTE,
- PERS_ID,
- INTM,
- UPTM,
- DATA_STAT,
- ID,
- YEAR_PLAN_ID,
- YEAR_CHK_NAME,
- YEAR_CHK_TYPE,
- ORGAN_DEP
- </sql>
- <sql id="entity_properties">
- #{ordr},
- #{adCode},
- #{chkTitle},
- #{chkMonth},
- #{chkDep},
- #{chkGrp},
- #{planSttm},
- #{planEntm},
- #{leadDep},
- #{joinDep},
- <!-- #{chkCity},-->
- <!-- #{chkCountry},-->
- #{chkSize},
- #{chkType},
- #{chkPers},
- #{chkPersTel},
- #{chkNote},
- #{persId},
- #{intm},
- #{uptm},
- #{dataStat},
- #{id},
- #{yearPlanId},
- #{yearChkName},
- #{yearChkType},
- #{organDep}
- </sql>
- <sql id="join_colum">
- t1.ORDR,
- t1.AD_CODE,
- t1.CHK_TITLE,
- t1.CHK_MONTH,
- t1.CHK_DEP,
- t1.CHK_GRP,
- t1.PLAN_STTM,
- t1.PLAN_ENTM,
- t1.LEAD_DEP,
- t1.JOIN_DEP,
- (SELECT
- GROUP_CONCAT(ad_code ORDER BY plan_month SEPARATOR ',' ) AS chkArea
- FROM
- BIS_INSP_PLAN_MONTH_AREA
- WHERE
- plan_month = t1.id
- AND data_stat = '0'
- AND ad_grad = '3'
- GROUP BY
- plan_month) as CHK_CITY_CODE,
- (SELECT
- GROUP_CONCAT(ad_name ORDER BY plan_month SEPARATOR ',' ) AS chkArea
- FROM
- BIS_INSP_PLAN_MONTH_AREA
- WHERE
- plan_month = t1.id
- AND data_stat = '0'
- AND ad_grad = '3'
- GROUP BY
- plan_month) as CHK_CITY,
- (SELECT
- GROUP_CONCAT(ad_code ORDER BY plan_month SEPARATOR ',' ) AS chkArea
- FROM
- BIS_INSP_PLAN_MONTH_AREA
- WHERE
- plan_month = t1.id
- AND data_stat = '0'
- AND ad_grad = '4'
- GROUP BY
- plan_month) as CHK_COUNTRY_CODE,
- (SELECT
- GROUP_CONCAT(ad_name ORDER BY plan_month SEPARATOR ',' ) AS chkArea
- FROM
- BIS_INSP_PLAN_MONTH_AREA
- WHERE
- plan_month = t1.id
- AND data_stat = '0'
- AND ad_grad = '4'
- GROUP BY
- plan_month) as CHK_COUNTRY,
- t1.CHK_SIZE,
- t1.CHK_TYPE,
- t1.CHK_PERS,
- t1.CHK_PERS_TEL,
- t1.CHK_NOTE,
- t1.PERS_ID,
- t1.INTM,
- t1.UPTM,
- t1.DATA_STAT,
- t1.ID,
- t1.YEAR_PLAN_ID,
- t1.YEAR_CHK_NAME,
- t1.YEAR_CHK_TYPE,
- t1.ORGAN_DEP
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="adCode != null and adCode != ''">and t1.AD_CODE like '${adCode}%'</if>
- <if test="chkTitle != null and chkTitle != ''">and t1.CHK_TITLE like '%${chkTitle}%'</if>
- <if test="chkMonth != null">and DATE_FORMAT(t1.CHK_MONTH,'%Y-%m') = DATE_FORMAT(#{chkMonth},'%Y-%m')</if>
- <if test="chkDep != null and chkDep != ''">and t1.CHK_DEP like '%${chkDep}%'</if>
- <if test="chkGrp != null and chkGrp != ''">and t1.CHK_GRP like '%${chkGrp}%'</if>
- <if test="planSttm != null">and t1.PLAN_STTM = #{planSttm}</if>
- <if test="planEntm != null">and t1.PLAN_ENTM = #{planEntm}</if>
- <if test="leadDep != null and leadDep != ''">and t1.LEAD_DEP = #{leadDep}</if>
- <if test="joinDep != null and joinDep != ''">and t1.JOIN_DEP = #{joinDep}</if>
- <!-- <if test="chkCity != null and chkCity != ''">and CHK_CITY = #{chkCity}</if>-->
- <!-- <if test="chkCountry != null and chkCountry != ''">and CHK_COUNTRY = #{chkCountry}</if>-->
- <if test="chkSize != null and chkSize != ''">and t1.CHK_SIZE = #{chkSize}</if>
- <if test="chkType != null and chkType != ''">and t1.CHK_TYPE = #{chkType}</if>
- <if test="chkPers != null and chkPers != ''">and t1.CHK_PERS = #{chkPers}</if>
- <if test="chkPersTel != null and chkPersTel != ''">and t1.CHK_PERS_TEL = #{chkPersTel}</if>
- <if test="chkNote != null and chkNote != ''">and t1.CHK_NOTE = #{chkNote}</if>
- <if test="persId != null and persId != ''">and t1.PERS_ID = #{persId}</if>
- <if test="intm != null">and t1.INTM = #{intm}</if>
- <if test="uptm != null">and t1.UPTM = #{uptm}</if>
- <if test="id != null and id != ''">and t1.ID = #{id}</if>
- <if test="yearChkName != null and yearChkName != ''">and YEAR_CHK_NAME = #{yearChkName}</if>
- <if test="yearChkType != null and yearChkType != ''">and YEAR_CHK_TYPE = #{yearChkType}</if>
- <if test="organDep != null and organDep != ''">and ORGAN_DEP = #{organDep}</if>
- and t1.DATA_STAT = '0'
- </trim>
- </sql>
- <select id="get" resultMap="bisInspPlanMonthResultMap" parameterType="String" >
- select <include refid="join_colum"/>
- from BIS_INSP_PLAN_MONTH t1
- where t1.ID = #{id}
- </select>
- <select id="getBy" resultMap="bisInspPlanMonthResultMap">
- select <include refid="join_colum"/>
- from BIS_INSP_PLAN_MONTH t1
- <include refid="page_where" />
- order by t1.ORDR ASC
- </select>
- <select id="findAll" resultMap="bisInspPlanMonthResultMap">
- select <include refid="join_colum"/>
- order by ORDR ASC
- </select>
- <select id="findList" resultMap="bisInspPlanMonthResultMap">
- SELECT * FROM (select <include refid="join_colum"/>
- from BIS_INSP_PLAN_MONTH t1
- <include refid="page_where"/>
- ) T2
- WHERE 1=1
- <if test="chkCity != null and chkCity != ''">
- AND ((CHK_CITY like '%${chkCity}%') or (CHK_COUNTRY like '%${chkCity}%'))
- </if>
- order by ORDR ASC
- </select>
- <select id="selectCount" resultType="int" >
- select count(ID) from BIS_INSP_PLAN_MONTH <include refid="page_where" />
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanMonth">
- insert into BIS_INSP_PLAN_MONTH( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- update BIS_INSP_PLAN_MONTH set DATA_STAT='9' where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanMonth">
- delete from BIS_INSP_PLAN_MONTH <include refid="page_where" />
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update BIS_INSP_PLAN_MONTH set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanMonth">
- update BIS_INSP_PLAN_MONTH
- <trim prefix="set" suffixOverrides=",">
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="chkTitle != null and chkTitle != ''">CHK_TITLE = #{chkTitle},</if>
- <if test="chkMonth != null">CHK_MONTH = #{chkMonth},</if>
- <if test="chkDep != null and chkDep != ''">CHK_DEP = #{chkDep},</if>
- <if test="chkGrp != null and chkGrp != ''">CHK_GRP = #{chkGrp},</if>
- <if test="planSttm != null">PLAN_STTM = #{planSttm},</if>
- <if test="planEntm != null">PLAN_ENTM = #{planEntm},</if>
- <if test="leadDep != null and leadDep != ''">LEAD_DEP = #{leadDep},</if>
- <if test="joinDep != null and joinDep != ''">JOIN_DEP = #{joinDep},</if>
- <!-- <if test="chkCity != null and chkCity != ''">CHK_CITY = #{chkCity},</if>-->
- <!-- <if test="chkCountry != null and chkCountry != ''">CHK_COUNTRY = #{chkCountry},</if>-->
- <if test="chkSize != null and chkSize != ''">CHK_SIZE = #{chkSize},</if>
- <if test="chkType != null and chkType != ''">CHK_TYPE = #{chkType},</if>
- <if test="chkPers != null and chkPers != ''">CHK_PERS = #{chkPers},</if>
- <if test="chkPersTel != null and chkPersTel != ''">CHK_PERS_TEL = #{chkPersTel},</if>
- <if test="chkNote != null and chkNote != ''">CHK_NOTE = #{chkNote},</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="ordr != null and ordr != ''">ORDR = #{ordr},</if>
- <if test="yearChkName != null and yearChkName != ''">YEAR_CHK_NAME = #{yearChkName},</if>
- <if test="yearChkType != null and yearChkType != ''">YEAR_CHK_TYPE = #{yearChkType},</if>
- <if test="yearPlanId != null and yearPlanId != ''">YEAR_PLAN_ID = #{yearPlanId},</if>
- <if test="organDep != null and organDep != ''">ORGAN_DEP = #{organDep},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanMonth">
- update BIS_INSP_PLAN_MONTH
- <trim prefix="set" suffixOverrides=",">
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="chkTitle != null and chkTitle != ''">CHK_TITLE = #{chkTitle},</if>
- <if test="chkMonth != null">CHK_MONTH = STR_TO_DATE(#{chkMonth},'%Y-%m'),</if>
- <if test="chkDep != null and chkDep != ''">CHK_DEP = #{chkDep},</if>
- <if test="chkGrp != null and chkGrp != ''">CHK_GRP = #{chkGrp},</if>
- <if test="planSttm != null">PLAN_STTM = #{planSttm},</if>
- <if test="planEntm != null">PLAN_ENTM = #{planEntm},</if>
- <if test="leadDep != null and leadDep != ''">LEAD_DEP = #{leadDep},</if>
- <if test="joinDep != null and joinDep != ''">JOIN_DEP = #{joinDep},</if>
- <!-- <if test="chkCity != null and chkCity != ''">CHK_CITY = #{chkCity},</if>-->
- <!-- <if test="chkCountry != null and chkCountry != ''">CHK_COUNTRY = #{chkCountry},</if>-->
- <if test="chkSize != null and chkSize != ''">CHK_SIZE = #{chkSize},</if>
- <if test="chkType != null and chkType != ''">CHK_TYPE = #{chkType},</if>
- <if test="chkPers != null and chkPers != ''">CHK_PERS = #{chkPers},</if>
- <if test="chkPersTel != null and chkPersTel != ''">CHK_PERS_TEL = #{chkPersTel},</if>
- <if test="chkNote != null and chkNote != ''">CHK_NOTE = #{chkNote},</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="id != null and id != ''">ID = #{id},</if>
- <if test="yearChkName != null and yearChkName != ''">YEAR_CHK_NAME = #{yearChkName},</if>
- <if test="yearChkType != null and yearChkType != ''">YEAR_CHK_TYPE = #{yearChkType},</if>
- <if test="yearPlanId != null and yearPlanId != ''">YEAR_PLAN_ID = #{yearPlanId},</if>
- <if test="organDep != null and organDep != ''">ORGAN_DEP = #{organDep},</if>
- </trim>
- <include refid="page_where" />
- </update>
- <select id="getByTimeRange" resultMap="bisInspPlanMonthResultMap">
- select <include refid="join_colum"/>
- from BIS_INSP_PLAN_MONTH t1
- where DATE_FORMAT(t1.CHK_MONTH,'%Y-%m') = DATE_FORMAT(#{checkMonth},'%Y-%m')
- and DATA_STAT = '0'
- </select>
- </mapper>
|