| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <?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.TacInspYearBatchAreaDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.TacInspYearBatchArea" id="tacInspYearBatchAreaResultMap">
- <result property="inTm" column="IN_TM"/>
- <result property="upTm" column="UP_TM"/>
- <result property="dataStat" column="DATA_STAT"/>
- <result property="id" column="ID"/>
- <result property="yearBatchId" column="YEAR_BATCH_ID"/>
- <result property="year" column="YEAR"/>
- <result property="batch" column="BATCH"/>
- <result property="groupId" column="GROUP_ID"/>
- <result property="groupNm" column="GROUP_NM"/>
- <result property="adCode" column="AD_CODE"/>
- <result property="adName" column="AD_NAME"/>
- <result property="persId" column="PERS_ID"/>
- <result property="province" column="PROVINCE"/>
- </resultMap>
- <sql id="table_columns">
- IN_TM,
- UP_TM,
- DATA_STAT,
- ID,
- YEAR_BATCH_ID,
- YEAR,
- BATCH,
- GROUP_ID,
- GROUP_NM,
- AD_CODE,
- AD_NAME,
- PERS_ID,PROVINCE
- </sql>
- <sql id="entity_properties">
- #{inTm},
- #{upTm},
- #{dataStat},
- #{id},
- #{yearBatchId},
- #{year},
- #{batch},
- #{groupId},
- #{groupNm},
- #{adCode},
- #{adName},
- #{persId},#{province}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="upTm != null">and UP_TM = #{upTm}</if>
- <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
- <if test="id != null and id != ''">and ID = #{id}</if>
- <if test="yearBatchId != null and yearBatchId != ''">and YEAR_BATCH_ID = #{yearBatchId}</if>
- <if test="year != null and year != ''">and YEAR = #{year}</if>
- <if test="batch != null and batch != ''">and BATCH = #{batch}</if>
- <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
- <if test="groupNm != null and groupNm != ''">and GROUP_NM = #{groupNm}</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="persId != null and persId != ''">and PERS_ID = #{persId}</if>
- <include refid="choseSql"/>
- </trim>
- </sql>
- <sql id="choseSql">
- <choose>
- <when test="province !=null and province !=''">
- AND t.province like concat(#{province},'%')
- </when>
- <otherwise>
- AND t.province is null
- </otherwise>
- </choose>
- </sql>
- <select id="get" resultMap="tacInspYearBatchAreaResultMap" parameterType="String" >
- select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_AREA where ID = #{id}
- </select>
- <select id="getBy" resultMap="tacInspYearBatchAreaResultMap">
- select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_AREA t <include refid="page_where" />
- </select>
- <select id="findAll" resultMap="tacInspYearBatchAreaResultMap">
- select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_AREA
- </select>
- <select id="findList" resultMap="tacInspYearBatchAreaResultMap">
- select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_AREA t <include refid="page_where" />
- </select>
- <select id="selectCount" resultType="int" >
- select count(ID) from TAC_INSP_YEAR_BATCH_AREA t <include refid="page_where" />
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchArea">
- insert into TAC_INSP_YEAR_BATCH_AREA( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from TAC_INSP_YEAR_BATCH_AREA where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchArea">
- delete from TAC_INSP_YEAR_BATCH_AREA t <include refid="page_where" />
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update TAC_INSP_YEAR_BATCH_AREA set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchArea">
- update TAC_INSP_YEAR_BATCH_AREA
- <trim prefix="set" suffixOverrides=",">
- <if test="upTm != null">UP_TM = #{upTm},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- <if test="id != null and id != ''">ID = #{id},</if>
- <if test="yearBatchId != null and yearBatchId != ''">YEAR_BATCH_ID = #{yearBatchId},</if>
- <if test="year != null and year != ''">YEAR = #{year},</if>
- <if test="batch != null and batch != ''">BATCH = #{batch},</if>
- <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
- <if test="groupNm != null and groupNm != ''">GROUP_NM = #{groupNm},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="province != null ">PROVINCE = #{province},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchArea">
- update TAC_INSP_YEAR_BATCH_AREA
- <trim prefix="set" suffixOverrides=",">
- <if test="upTm != null">UP_TM = #{upTm},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- <if test="id != null and id != ''">ID = #{id},</if>
- <if test="yearBatchId != null and yearBatchId != ''">YEAR_BATCH_ID = #{yearBatchId},</if>
- <if test="year != null and year != ''">YEAR = #{year},</if>
- <if test="batch != null and batch != ''">BATCH = #{batch},</if>
- <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
- <if test="groupNm != null and groupNm != ''">GROUP_NM = #{groupNm},</if>
- <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
- <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="province != null ">PROVINCE = #{province},</if>
- </trim>
- <include refid="page_where" />
- </update>
- <!-- 其他自定义SQL -->
- <select id="getAreaListById" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchAreaParam" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchArea">
- select * from TAC_INSP_YEAR_BATCH_AREA t
- where t.group_id in (select group_id from tac_insp_year_batch_group_pers p,tac_insp_year_batch h where p.year_batch_id=h.id and h.data_stat='0'
- and p.pers_id = #{workerbId}
- <if test="years != null and years != ''">
- and p.year in (${years})
- </if>
- <include refid="choseSql"/>
- <if test="year != null">
- and t.year = #{year}
- </if>
- <if test="batch != null">
- and t.batch = #{batch}
- </if>
- <if test="batchs != null and batchs != ''">
- and p.batch in (${batchs})
- </if>
- )
- </select>
- <!-- 其他自定义SQL -->
- <select id="areasListByBatch" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchAreaParam" resultType="java.util.HashMap">
- select area.BATCH as "batch", GROUP_CONCAT(area.AD_NAME ORDER BY area.BATCH SEPARATOR ',' ) as "adName"
- from (select distinct t.BATCH, t.AD_NAME
- from TAC_INSP_YEAR_BATCH_AREA t
- where t.year_batch_id in (SELECT id FROM TAC_INSP_YEAR_BATCH)
- <include refid="choseSql"/>
- <if test="year != null">
- and t.year = #{year}
- </if>)area
- group by area.BATCH
- </select>
- <select id="countAdcodeAuditByYear" resultType="cn.com.goldenwater.dcproj.dto.TacCountDto" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchAreaParam">
- select count(*)as count,a.ad_code as code,a.ad_name as name from (
- select t.* from TAC_INSP_YEAR_BATCH_AREA t where t.year = #{year}
- <if test="persId != null and persId != ''">
- and t.group_id in (select group_id from tac_insp_year_batch_group_pers p where p.pers_id in (select id from tac_worker_b where login_id = #{persId}))
- </if>
- <if test="batch != null">
- and t.batch = #{batch}
- </if>
- <include refid="choseSql"/>
- ) a group by a.ad_code,a.ad_name order by a.ad_code
- </select>
- <select id="getAdNameList" resultType="cn.com.goldenwater.dcproj.dto.TacCountDto" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchAreaParam">
- SELECT distinct t.Ad_name as name,'1' as value,t.year,t.batch from TAC_INSP_YEAR_BATCH_AREA t where t.group_id in (${groupId})
- <include refid="choseSql"/>
- </select>
- <select id="listByMap" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchArea">
- SELECT DISTINCT Y.*,O.OJB_NM
- FROM TAC_INSP_YEAR_BATCH_AREA Y
- JOIN TAC_INSP_YEAR_BATCH_OBJ O ON Y.GROUP_ID = O.GROUP_ID
- <where>
- <if test="province != null and province != ''">
- and Y.PROVINCE = #{province}
- </if>
- <if test="year != null and year != ''">
- and Y.YEAR like CONCAT('%' , #{year} , '%')
- </if>
- <if test="batch != null and batch != ''">
- and Y.BATCH like CONCAT('%' , #{batch} , '%')
- </if>
- <if test="groupNm != null and groupNm != ''">
- and Y.GROUP_NM like CONCAT('%' , #{groupNm}, '%')
- </if>
- <if test="adName != null and adName != ''">
- and Y.AD_NAME like CONCAT('%' , #{adName}, '%')
- </if>
- <if test="inTm != null and inTm != ''">
- and Y.IN_TM like CONCAT( '%' , #{inTm} , '%')
- </if>
- <if test="upTm != null and upTm != ''">
- and Y.UP_TM like CONCAT('%' , #{upTm}, '%')
- </if>
- <if test="ojbNm != null and ojbNm != ''">
- and O.OJB_NM like CONCAT('%' , #{ojbNm} , '%')
- </if>
- </where>
- </select>
- </mapper>
|