| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334 |
- <?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.TacInspYearBatchGroupDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroup" id="tacInspYearBatchGroupResultMap">
- <result property="id" column="ID"/>
- <result property="yearBatchId" column="YEAR_BATCH_ID"/>
- <result property="year" column="YEAR"/>
- <result property="batch" column="BATCH"/>
- <result property="groupNm" column="GROUP_NM"/>
- <result property="audContent" column="AUD_CONTENT"/>
- <result property="tenet" column="TENET"/>
- <result property="isAppraisal" column="IS_APPRAISAL"/>
- <result property="audUnits" column="AUD_UNITS"/>
- <result property="audCategory" column="AUD_CATEGORY"/>
- <result property="remark" column="REMARK"/>
- <result property="persId" column="PERS_ID"/>
- <result property="inTm" column="IN_TM"/>
- <result property="upTm" column="UP_TM"/>
- <result property="dataStat" column="DATA_STAT"/>
- <result property="pris" column="PRIS"/>
- <result property="stTm" column="ST_TM"/>
- <result property="enTm" column="EN_TM"/>
- <result property="confirmer" column="CONFIRMER"/>
- </resultMap>
- <sql id="table_columns">
- ID,
- YEAR_BATCH_ID,
- YEAR,
- BATCH,
- GROUP_NM,
- AUD_CONTENT,
- TENET,
- IS_APPRAISAL,
- AUD_UNITS,
- AUD_CATEGORY,
- REMARK,
- PERS_ID,
- IN_TM,
- UP_TM,
- DATA_STAT,
- PRIS,
- ST_TM,
- EN_TM,
- CONFIRMER
- </sql>
- <sql id="entity_properties">
- #{id},
- #{yearBatchId},
- #{year},
- #{batch},
- #{groupNm},
- #{audContent},
- #{tenet},
- #{isAppraisal},
- #{audUnits},
- #{audCategory},
- #{remark},
- #{persId},
- #{inTm},
- #{upTm},
- #{dataStat},
- #{pris},
- #{stTm},#{enTm},
- #{confirmer}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <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="groupNm != null and groupNm != ''">and GROUP_NM = #{groupNm}</if>
- <if test="audContent != null and audContent != ''">and AUD_CONTENT = #{audContent}</if>
- <if test="tenet != null and tenet != ''">and TENET = #{tenet}</if>
- <if test="isAppraisal != null and isAppraisal != ''">and IS_APPRAISAL = #{isAppraisal}</if>
- <if test="audUnits != null and audUnits != ''">and AUD_UNITS = #{audUnits}</if>
- <if test="audCategory != null and audCategory != ''">and AUD_CATEGORY = #{audCategory}</if>
- <if test="remark != null and remark != ''">and REMARK = #{remark}</if>
- <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
- <if test="inTm != null">and IN_TM = #{inTm}</if>
- <if test="upTm != null">and UP_TM = #{upTm}</if>
- <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
- <if test="pris != null and pris != ''">and PRIS = #{pris}</if>
- <if test="confirmer != null and confirmer != ''">and CONFIRMER = #{confirmer}</if>
- </trim>
- </sql>
- <select id="get" resultMap="tacInspYearBatchGroupResultMap" parameterType="String" >
- select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_GROUP where ID = #{id}
- </select>
- <select id="getBy" resultMap="tacInspYearBatchGroupResultMap">
- select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_GROUP <include refid="page_where" />
- </select>
- <select id="findAll" resultMap="tacInspYearBatchGroupResultMap">
- select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_GROUP
- </select>
- <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="findList" resultMap="tacInspYearBatchGroupResultMap">
- select p.* from TAC_INSP_YEAR_BATCH_GROUP p ,TAC_INSP_YEAR_BATCH t where p.year_batch_id=t.id
- <include refid="choseSql"/>
- <if test="yearBatchId != null and yearBatchId != ''">and p.YEAR_BATCH_ID = #{yearBatchId}</if>
- <if test="year != null and year != ''">and p.YEAR = #{year}</if>
- <if test="batch != null and batch != ''">and p.BATCH = #{batch}</if>
- <if test="groupNm != null and groupNm != ''">and p.GROUP_NM = #{groupNm}</if>
- <if test="audContent != null and audContent != ''">and p.AUD_CONTENT = #{audContent}</if>
- <if test="tenet != null and tenet != ''">and p.TENET = #{tenet}</if>
- <if test="isAppraisal != null and isAppraisal != ''">and p.IS_APPRAISAL = #{isAppraisal}</if>
- <if test="audUnits != null and audUnits != ''">and p.AUD_UNITS = #{audUnits}</if>
- <if test="audCategory != null and audCategory != ''">and p.AUD_CATEGORY = #{audCategory}</if>
- <if test="remark != null and remark != ''">and p.REMARK = #{remark}</if>
- <if test="persId != null and persId != ''">and p.PERS_ID = #{persId}</if>
- <if test="inTm != null">and p.IN_TM = #{inTm}</if>
- <if test="upTm != null">and p.UP_TM = #{upTm}</if>
- <if test="dataStat != null and dataStat != ''">and p.DATA_STAT = #{dataStat}</if>
- <if test="pris != null and pris != ''">and p.PRIS = #{pris}</if>
- <if test="confirmer != null and confirmer != ''">and CONFIRMER = #{confirmer}</if>
- </select>
- <select id="selectCount" resultType="int" >
- select count(ID) from TAC_INSP_YEAR_BATCH_GROUP <include refid="page_where" />
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroup">
- insert into TAC_INSP_YEAR_BATCH_GROUP( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from TAC_INSP_YEAR_BATCH_GROUP where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroup">
- delete from TAC_INSP_YEAR_BATCH_GROUP <include refid="page_where" />
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update TAC_INSP_YEAR_BATCH_GROUP set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroup">
- update TAC_INSP_YEAR_BATCH_GROUP
- <trim prefix="set" suffixOverrides=",">
- <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="groupNm != null and groupNm != ''">GROUP_NM = #{groupNm},</if>
- <if test="audContent != null and audContent != ''">AUD_CONTENT = #{audContent},</if>
- <if test="tenet != null and tenet != ''">TENET = #{tenet},</if>
- <if test="isAppraisal != null and isAppraisal != ''">IS_APPRAISAL = #{isAppraisal},</if>
- <if test="audUnits != null and audUnits != ''">AUD_UNITS = #{audUnits},</if>
- <if test="audCategory != null and audCategory != ''">AUD_CATEGORY = #{audCategory},</if>
- <if test="remark != null and remark != ''">REMARK = #{remark},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="inTm != null">IN_TM = #{inTm},</if>
- <if test="upTm != null">UP_TM = #{upTm},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- <if test="pris != null and pris != ''">PRIS = #{pris},</if>
- <if test="stTm != null">ST_TM = #{stTm},</if>
- <if test="enTm != null">EN_TM = #{enTm},</if>
- <if test="confirmer != null">CONFIRMER = #{confirmer},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroup">
- update TAC_INSP_YEAR_BATCH_GROUP
- <trim prefix="set" suffixOverrides=",">
- <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="groupNm != null and groupNm != ''">GROUP_NM = #{groupNm},</if>
- <if test="audContent != null and audContent != ''">AUD_CONTENT = #{audContent},</if>
- <if test="tenet != null and tenet != ''">TENET = #{tenet},</if>
- <if test="isAppraisal != null and isAppraisal != ''">IS_APPRAISAL = #{isAppraisal},</if>
- <if test="audUnits != null and audUnits != ''">AUD_UNITS = #{audUnits},</if>
- <if test="audCategory != null and audCategory != ''">AUD_CATEGORY = #{audCategory},</if>
- <if test="remark != null and remark != ''">REMARK = #{remark},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="inTm != null">IN_TM = #{inTm},</if>
- <if test="upTm != null">UP_TM = #{upTm},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- <if test="pris != null and pris != ''">PRIS = #{pris},</if>
- <if test="stTm != null">ST_TM = #{stTm},</if>
- <if test="enTm != null">EN_TM = #{enTm},</if>
- <if test="confirmer != null">CONFIRMER = #{confirmer},</if>
- </trim>
- <include refid="page_where" />
- </update>
- <!-- 其他自定义SQL -->
- <select id="getMaxGourpNum" resultType="java.lang.String" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchGroupParam">
- select max(GROUP_NM) from TAC_INSP_YEAR_BATCH_GROUP where YEAR_BATCH_ID = #{yearBatchId}
- </select>
- <select id="getGroupListByPersId" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroup" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchGroupParam">
- select t.*,'group' as flag from TAC_INSP_YEAR_BATCH_GROUP t
- where 1=1
- <if test="persId != null and persId != ''">
- REGEXP_LIKE(
- t.id,CONCAT('^(',
- ( case when(SELECT count(group_id) from TAC_INSP_YEAR_BATCH_GROUP_PERS WHERE PERS_ID =#{persId})>0 then
- (SELECT GROUP_CONCAT(group_id ORDER BY PERS_ID SEPARATOR '|' ) as
- id FROM TAC_INSP_YEAR_BATCH_GROUP_PERS WHERE PERS_ID =#{persId})
- else (select 'non' from dual) end)
- ,')'))
- </if>
- <if test="workerId != null and workerId != ''">
- AND t.id in (SELECT group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS WHERE PERS_ID =#{workerId})
- </if>
- <if test="year != null">
- AND t.year = #{year}
- </if>
- <if test="batch != null">
- AND t.batch = #{batch}
- </if>
- <if test="yearBatchId != null and yearBatchId != ''">
- and t.year_batch_id = #{yearBatchId}
- </if>
- </select>
- <select id="getGroupListApp" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroup" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchGroupParam">
- select t.* from TAC_INSP_YEAR_BATCH_GROUP t
- where 1=1
- <if test="persId != null and persId != ''">
- and t.id in (
- select t.group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t WHERE PERS_ID in (select t.id from TAC_WORKER_B t where t.login_id = #{persId}
- <include refid="choseSql"/>
- )
- )
- </if>
- <if test="loginId != null and loginId != ''">
- and t.id in (
- select t.group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t WHERE PERS_ID in (select t.id from TAC_WORKER_B t where t.login_id = #{loginId}
- <include refid="choseSql"/>
- )
- )
- </if>
- <if test="year != null and year != ''">
- and t.year = #{year}
- </if>
- <if test="batch != null and batch != ''">
- and t.batch = #{batch}
- </if>
- order by in_tm DESC
- </select>
- <update id="updateByBatchId" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroup">
- update TAC_INSP_YEAR_BATCH_GROUP t
- set t.st_tm = #{stTm},t.en_tm = #{enTm} where t.year_batch_id = #{yearBatchId}
- </update>
- <select id="getCurrentGroupList" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroup" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchGroupParam">
- select t.* from TAC_INSP_YEAR_BATCH_GROUP t left join TAC_INSP_YEAR_BATCH b on t.YEAR_BATCH_ID = b.id
- where 1=1
- <if test="useCurrTm != null and useCurrTm != ''">
- and t.st_tm < sysdate() and t.en_tm > sysdate()
- </if>
- <if test="useCurrTm == null">
- and t.en_tm < sysdate()
- </if>
- <if test="persId != null and persId != ''">
- and t.id in (
- select t.group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t WHERE PERS_ID = (select b.id from TAC_WORKER_B b where b.login_id = #{persId})
- )
- </if>
- <if test="year != null">
- and t.year = #{year}
- </if>
- <choose>
- <when test="province !=null and province !=''">
- and b.province=#{province}
- </when>
- <otherwise>
- and b.province is null
- </otherwise>
- </choose>
- order by t.batch DESC
- </select>
- <select id="getGradeGroupList" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchGroup">
- select
- t.ID,
- t.YEAR_BATCH_ID,
- t.YEAR,
- t.BATCH,
- t.GROUP_NM,
- t.AUD_CONTENT,
- t.TENET,
- t.IS_APPRAISAL,
- t.AUD_UNITS,
- t.AUD_CATEGORY,
- t.REMARK,
- t.PERS_ID,
- t.IN_TM,
- t.UP_TM,
- t.DATA_STAT,
- t.PRIS,
- t.ST_TM,
- t.EN_TM,
- b.PERS_ID AS TAC_PERS_ID
- from TAC_INSP_YEAR_BATCH_GROUP t
- inner join (
- select distinct group_id,pers_id from TAC_INSP_YEAR_BATCH_GROUP_PERS
- where pers_id = (select id from TAC_WORKER_B where login_id = #{persId}) and group_id is not null
- ) b on t.id = b.group_id
- <where>
- <if test="year != null">
- t.year = #{year}
- </if>
- </where>
- </select>
- </mapper>
|