| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 |
- <?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.TacInspYearBatchObjDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.TacInspYearBatchObj" id="tacInspYearBatchObjResultMap">
- <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="ojbId" column="OJB_ID"/>
- <result property="ojbNm" column="OJB_NM"/>
- <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="province" column="PROVINCE"/>
- <result property="sn" column="SN"/>
- </resultMap>
-
- <sql id="table_columns">
- ID,
- YEAR_BATCH_ID,
- YEAR,
- BATCH,
- GROUP_ID,
- GROUP_NM,
- OJB_ID,
- OJB_NM,
- PERS_ID,
- IN_TM,
- UP_TM,
- DATA_STAT,PROVINCE,SN
- </sql>
- <sql id="entity_properties">
- #{id},
- #{yearBatchId},
- #{year},
- #{batch},
- #{groupId},
- #{groupNm},
- #{ojbId},
- #{ojbNm},
- #{persId},
- #{inTm},
- #{upTm},
- #{dataStat},#{province},#{sn}
- </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="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
- <if test="groupNm != null and groupNm != ''">and GROUP_NM = #{groupNm}</if>
- <if test="ojbId != null and ojbId != ''">and OJB_ID = #{ojbId}</if>
- <if test="ojbNm != null and ojbNm != ''">and OJB_NM = #{ojbNm}</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>
- <include refid="choseSql"/>
- </trim>
- </sql>
- <sql id="choseSql">
- <choose>
- <when test="province !=null and province !=''">
- AND t.PROVINCE=#{province}
- </when>
- <otherwise>
- AND t.PROVINCE is null
- </otherwise>
- </choose>
- </sql>
- <select id="get" resultMap="tacInspYearBatchObjResultMap" parameterType="String" >
- select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_OBJ where ID = #{id}
- </select>
- <select id="getBy" resultMap="tacInspYearBatchObjResultMap">
- select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_OBJ t <include refid="page_where" />
- </select>
- <select id="findAll" resultMap="tacInspYearBatchObjResultMap">
- select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_OBJ
- </select>
- <select id="findList" resultMap="tacInspYearBatchObjResultMap">
- select <include refid="table_columns" /> from TAC_INSP_YEAR_BATCH_OBJ t <include refid="page_where" />
- order by t.sn asc
- </select>
- <select id="getObjAndType" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchObjParam" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchObj">
- select t.ID
- , t.YEAR_BATCH_ID
- , t.YEAR
- , t.BATCH
- , t.GROUP_ID
- , t.GROUP_NM
- , t.OJB_ID
- , t.PERS_ID
- , t.IN_TM
- , t.UP_TM
- , t.DATA_STAT
- , t.PROVINCE
- , t.SN,r.TYPE as TYPE , tt.name as ojb_nm from TAC_INSP_YEAR_BATCH_OBJ t left join tac_pawp_rgstr r on t.id = r.obj_id
- left join TAC_ATT_PAWP_BASE tt on tt.id = t.ojb_id
- where 1=1
- <if test="yearBatchId != null and yearBatchId != ''">and t.YEAR_BATCH_ID = #{yearBatchId}</if>
- <if test="year != null and year != ''">and t.YEAR = #{year}</if>
- <if test="batch != null and batch != ''">and t.BATCH = #{batch}</if>
- <if test="groupId != null and groupId != ''">and t.GROUP_ID = #{groupId}</if>
- <if test="groupNm != null and groupNm != ''">and t.GROUP_NM = #{groupNm}</if>
- <if test="ojbId != null and ojbId != ''">and t.OJB_ID = #{ojbId}</if>
- <if test="ojbNm != null and ojbNm != ''">and t.OJB_NM = #{ojbNm}</if>
- <if test="persId != null and persId != ''">and t.PERS_ID = #{persId}</if>
- <if test="inTm != null">and t.IN_TM = #{inTm}</if>
- <if test="upTm != null">and t.UP_TM = #{upTm}</if>
- <if test="dataStat != null and dataStat != ''">and t.DATA_STAT = #{dataStat}</if>
- order by t.sn asc
- </select>
- <select id="selectCount" resultType="int" >
- select count(ID) from TAC_INSP_YEAR_BATCH_OBJ t <include refid="page_where" />
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchObj">
- insert into TAC_INSP_YEAR_BATCH_OBJ( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from TAC_INSP_YEAR_BATCH_OBJ where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchObj">
- delete from TAC_INSP_YEAR_BATCH_OBJ t <include refid="page_where" />
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update TAC_INSP_YEAR_BATCH_OBJ set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacInspYearBatchObj">
- update TAC_INSP_YEAR_BATCH_OBJ
- <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="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
- <if test="groupNm != null and groupNm != ''">GROUP_NM = #{groupNm},</if>
- <if test="ojbId != null and ojbId != ''">OJB_ID = #{ojbId},</if>
- <if test="ojbNm != null and ojbNm != ''">OJB_NM = #{ojbNm},</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="sn != null">SN = #{sn},</if>
- <if test="province != null">PROVINCE = #{province},</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.TacInspYearBatchObj">
- update TAC_INSP_YEAR_BATCH_OBJ
- <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="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
- <if test="groupNm != null and groupNm != ''">GROUP_NM = #{groupNm},</if>
- <if test="ojbId != null and ojbId != ''">OJB_ID = #{ojbId},</if>
- <if test="ojbNm != null and ojbNm != ''">OJB_NM = #{ojbNm},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="inTm != null">IN_TM = #{inTm},</if>
- <if test="province != null">PROVINCE = #{province},</if>
- <if test="sn != null">SN = #{sn},</if>
- <if test="upTm != null">UP_TM = #{upTm},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- </trim>
- <include refid="page_where" />
- </update>
- <!-- 其他自定义SQL -->
- <select id="getObjList" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchObjParam" resultType="cn.com.goldenwater.dcproj.dto.TacInspYearBatchObjDto">
- select t.year_batch_id,t.year,t.batch,t.GROUP_NM,rg.ID
- , rg.OBJ_ID
- , rg.ADM_ORG
- , rg.AD_CODE
- , rg.LOCATION
- , rg.TYPE
- , rg.ITME_DESC
- , rg.ITME_EVAL
- , rg.KATALOG
- , rg.SPCLT_YM
- , rg.REV_OPIN
- , rg.REV_TM
- , rg.CENTER_X
- , rg.CENTER_Y
- , rg.GD_X
- , rg.GD_Y
- , rg.NOTE
- , rg.STATE
- , rg.DATA_STAT
- , rg.PDBST_STAT
- , rg.BSTOCM_PLPRS_STAT
- , rg.BSTOCM_TSOPBFP_STAT
- , rg.BSTOCM_CPSS_STAT
- , rg.BSTOCM_CMS_STAT
- , rg.RAIOBIS_STAT
- , rg.BIOFUAM_STAT
- , rg.BITOPQ_QMS_STAT
- , rg.BITOPQ_PEQAA_STAT
- , rg.BIOES_PE_STAT
- , rg.BIOES_RWUNIT_STAT
- , rg.PERS_ID
- , rg.GROUP_ID
- , rg.INTM
- , rg.UPTM
- , rg.ORG_ID
- , rg.AD_NAME
- , rg.IS_POVERTY
- , rg.PROVINCE
- , rg.TASK_ID
- , rg.BACKUP,'8' as ptype,t.OJB_NM ,tt.name from TAC_INSP_YEAR_BATCH_OBJ t left join Tac_Pawp_Rgstr rg on t.id = rg.OBj_ID
- left join TAC_ATT_PAWP_BASE tt on tt.id = t.ojb_id
- where 1=1
- <if test="persId != null and persId != ''">
- and t.group_id in (
- select t.group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t WHERE PERS_ID in (
- select b.id from TAC_WORKER_B b where b.login_id = #{persId}
- <trim>
- <choose>
- <when test="province !=null and province !=''">
- AND b.PROVINCE=#{province}
- </when>
- <otherwise>
- AND b.PROVINCE is null
- </otherwise>
- </choose>
- </trim>
- )
- )
- </if>
- <include refid="choseSql"/>
- <if test="yearBatchId != null and yearBatchId != ''">
- and t.year_batch_id = #{yearBatchId}
- </if>
- <if test="year != null and year != ''">
- and t.year = #{year}
- </if>
- <if test="batch != null and batch != ''">
- and t.batch = #{batch}
- </if>
- <if test="adCode != null and adCode != ''">
- and rg.ad_code like '%' || substr(#{adCode},0,4) || '%'
- </if>
- <if test="groupId != null and groupId != ''">
- and t.group_id = #{groupId}
- </if>
- <if test="ojbNm != null and ojbNm != ''">
- and t.ojb_nm like '%${ojbNm}%'
- </if>
- <if test="state != null and state != ''">
- and rg.state = #{state}
- </if>
- <if test="type != null and type != ''">
- and rg.type = #{type}
- </if>
- order by rg.INTM desc
- </select>
- <!-- 山东稽察 汇总成果 增加在批次下选择项目 -->
- <select id="objslistbybatch" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchObjParam" resultType="cn.com.goldenwater.dcproj.dto.TacInspYearBatchObjDto">
- select t.YEAR_BATCH_ID, t.GROUP_ID, t.OJB_ID as OBJ_ID, t.OJB_NM from TAC_INSP_YEAR_BATCH_OBJ t
- left join Tac_Pawp_Rgstr rg on t.id = rg.OBj_ID
- where 1=1
- <include refid="choseSql"/>
- <if test="yearBatchId != null and yearBatchId != ''">
- and t.year_batch_id = #{yearBatchId}
- </if>
- <if test="year != null and year != ''">
- and t.year = #{year}
- </if>
- <if test="batch != null and batch != ''">
- and t.batch = #{batch}
- </if>
- <if test="adCode != null and adCode != ''">
- and rg.ad_code like '%' || substr(#{adCode},0,4) || '%'
- </if>
- <if test="groupId != null and groupId != ''">
- and t.group_id = #{groupId}
- </if>
- <if test="ojbNm != null and ojbNm != ''">
- and t.ojb_nm like '%${ojbNm}%'
- </if>
- <if test="state != null and state != ''">
- and rg.state = #{state}
- </if>
- <if test="type != null and type != ''">
- and rg.type = #{type}
- </if>
- order by t.SN asc
- </select>
- <select id="getBaseNotInGroupByGroupId" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchObjParam" resultType="cn.com.goldenwater.dcproj.model.TacAttPawpBase">
- select distinct * from (
- select t.* from TAC_ATT_PAWP_BASE t where t.id not in (
- select OJB_ID from TAC_INSP_YEAR_BATCH_OBJ t where group_id = #{groupId}
- <include refid="choseSql"/>
- )
- <include refid="choseSql"/>
- <if test="ojbNm != null and ojbNm != ''">and t.name LIKE '%${ojbNm}%'</if>
- <if test="engSta != null and engSta != ''">and t.type LIKE '%${engSta}%'</if>
- ) where 1=1
- <if test="adCode != null and adCode != ''">and ${adCode}</if>
- ORDER BY
- <if test="orderBy != null and orderBy != ''">${orderBy},</if>
- ad_code,name
- </select>
- <select id="getObjTreeList" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchObjParam" resultType="cn.com.goldenwater.dcproj.model.TacInspYearBatchObj">
- select r.ad_code,t.*,r.id as rgstrId,(case when r.state is null then '0' else r.state end) state,r.TASK_ID taskId from TAC_INSP_YEAR_BATCH_OBJ t
- join TAC_INSP_YEAR_BATCH h on t.year_batch_id=h.id join tac_pawp_rgstr r on t.id = r.obj_id
- where 1=1
- <if test="persId != null and persId != ''">
- and t.group_id in (
- select t.group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t WHERE PERS_ID in (select b.id from TAC_WORKER_B b where b.login_id = #{persId}
- <if test=' "1" == isEval'>
- <!-- 外聘稽查专家测评 isExternal 是否外聘 0否 1是 -->
- AND (b.IS_EXTERNAL != '1' or b.IS_EXTERNAL is null)
- </if>
- )
- <!-- 外聘稽查专家测评 稽查专家、助理、组长、特派员 -->
- <if test=' "1" == isEval'>
- AND PERS_ID in (select WORKERID from tac_worker_type where TYPE='1' and instr(',11,12,13,14,15,16,19,20,21,' , ','||VALUE||',') > 0 )
- </if>
- <!--专家组长测评 稽查专家、助理、特派员 -->
- <if test=' "2" == isEval'>
- AND PERS_ID in (select WORKERID from tac_worker_type where TYPE='1' and instr(',11,12,13,14,15,16,19,21,' , ','||VALUE||',') > 0 )
- </if>
- )
- </if>
- <include refid="choseSql"/>
- <if test="year != null and year != ''">
- and t.year = #{year}
- </if>
- <if test="batch != null and batch != ''">
- and t.batch = #{batch}
- </if>
- order by t.year desc,t.batch desc,to_number(t.group_nm)
- </select>
- <select id="getObjListByPersId" parameterType="cn.com.goldenwater.dcproj.param.TacInspYearBatchObjParam" resultType="cn.com.goldenwater.dcproj.dto.TacInspYearBatchObjDto">
- select * from (
- select rg.id,
- rg.obj_id,
- rg.name,
- rg.ADM_ORG,
- rg.LOCATION,
- rg.type,
- rg.ITME_DESC,
- rg.ITME_EVAL,
- rg.ad_code,
- (case when rg.CENTER_X is null then ba.CENTER_X else rg.CENTER_X end) CENTER_X,
- (case when rg.CENTER_Y is null then ba.CENTER_Y else rg.CENTER_Y end) CENTER_Y,
- (case when rg.GD_X is null then ba.GD_X else rg.GD_X end) GD_X,
- (case when rg.GD_Y is null then ba.GD_Y else rg.GD_Y end) GD_Y,
- rg.state,t.ojb_id as baseId,t.year,t.batch,t.group_id,t.YEAR_BATCH_ID
- from TAC_INSP_YEAR_BATCH_OBJ t left join Tac_Pawp_Rgstr rg on t.id = rg.OBj_ID left join TAC_ATT_PAWP_BASE ba on t.OJB_ID = ba.id
- where 1=1
- <if test="persId != null and persId != ''">
- and t.group_id in (
- select t.group_id from TAC_INSP_YEAR_BATCH_GROUP_PERS t WHERE PERS_ID in (select b.id from TAC_WORKER_B b where b.login_id = #{persId})
- )
- </if>
- <include refid="choseSql"/>
- <if test="year != null">
- and t.year = #{year}
- </if>
- <if test="batch != null">
- and t.batch = #{batch}
- </if>
- <if test="adCode != null and adCode != ''">
- and rg.ad_Code like '${adCode}%'
- </if>
- <if test="type != null and type != ''">
- and rg.type = #{type}
- </if>
- <if test="name != null and name != ''">
- and rg.name like '%${name}%'
- </if>
- <if test="ojbId != null and ojbId != ''">
- and t.ojb_id = #{ojbId}
- </if>
- ) t where 1=1
- <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and t.CENTER_X BETWEEN
- #{minLgtd} AND #{maxLgtd}
- </if>
- <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and t.CENTER_Y BETWEEN
- #{minLttd} AND #{maxLttd}
- </if>
- <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
- t.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
- </if>
- <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
- t.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
- </if>
- </select>
- <select id="getObjListByGroupIdList" resultType="String">
- select ID from TAC_INSP_YEAR_BATCH_OBJ
- where group_id in
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </select>
- </mapper>
|