| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <?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.TacExprRcmmRcrdDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.TacExprRcmmRcrd" id="tacExprRcmmRcrdResultMap">
- <result property="id" column="ID"/>
- <result property="exprRcmmId" column="EXPR_RCMM_ID"/>
- <result property="state" column="STATE"/>
- <result property="note" column="NOTE"/>
- <result property="isSm" column="IS_SM"/>
- <result property="isMsg" column="IS_MSG"/>
- <result property="persId" column="PERS_ID"/>
- <result property="intm" column="INTM"/>
- <result property="uptm" column="UPTM"/>
- <result property="dataStat" column="DATA_STAT"/>
- </resultMap>
-
- <sql id="table_columns">
- ID,
- EXPR_RCMM_ID,
- STATE,
- NOTE,
- IS_SM,
- IS_MSG,
- PERS_ID,
- INTM,
- UPTM,
- DATA_STAT
- </sql>
- <sql id="entity_properties">
- #{id},
- #{exprRcmmId},
- #{state},
- #{note},
- #{isSm},
- #{isMsg},
- #{persId},
- #{intm},
- #{uptm},
- #{dataStat}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="exprRcmmId != null and exprRcmmId != ''">and EXPR_RCMM_ID = #{exprRcmmId}</if>
- <if test="state != null and state != ''">and STATE = #{state}</if>
- <if test="note != null and note != ''">and NOTE = #{note}</if>
- <if test="isSm != null and isSm != ''">and IS_SM = #{isSm}</if>
- <if test="isMsg != null and isMsg != ''">and IS_MSG = #{isMsg}</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>
- </trim>
- </sql>
- <select id="get" resultMap="tacExprRcmmRcrdResultMap" parameterType="String" >
- select <include refid="table_columns" /> from TAC_EXPR_RCMM_RCRD where ID = #{id}
- </select>
- <select id="getBy" resultMap="tacExprRcmmRcrdResultMap">
- select <include refid="table_columns" /> from TAC_EXPR_RCMM_RCRD <include refid="page_where" />
- </select>
- <select id="findAll" resultMap="tacExprRcmmRcrdResultMap">
- select <include refid="table_columns" /> from TAC_EXPR_RCMM_RCRD
- </select>
- <select id="findList" resultMap="tacExprRcmmRcrdResultMap">
- select <include refid="table_columns" /> from TAC_EXPR_RCMM_RCRD <include refid="page_where" />
- </select>
- <select id="selectCount" resultType="int" >
- select count(ID) from TAC_EXPR_RCMM_RCRD <include refid="page_where" />
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacExprRcmmRcrd">
- insert into TAC_EXPR_RCMM_RCRD( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from TAC_EXPR_RCMM_RCRD where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacExprRcmmRcrd">
- delete from TAC_EXPR_RCMM_RCRD <include refid="page_where" />
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update TAC_EXPR_RCMM_RCRD set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacExprRcmmRcrd">
- update TAC_EXPR_RCMM_RCRD
- <trim prefix="set" suffixOverrides=",">
- <if test="exprRcmmId != null and exprRcmmId != ''">EXPR_RCMM_ID = #{exprRcmmId},</if>
- <if test="state != null and state != ''">STATE = #{state},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="isSm != null and isSm != ''">IS_SM = #{isSm},</if>
- <if test="isMsg != null and isMsg != ''">IS_MSG = #{isMsg},</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>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacExprRcmmRcrd">
- update TAC_EXPR_RCMM_RCRD
- <trim prefix="set" suffixOverrides=",">
- <if test="exprRcmmId != null and exprRcmmId != ''">EXPR_RCMM_ID = #{exprRcmmId},</if>
- <if test="state != null and state != ''">STATE = #{state},</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="isSm != null and isSm != ''">IS_SM = #{isSm},</if>
- <if test="isMsg != null and isMsg != ''">IS_MSG = #{isMsg},</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>
- </trim>
- <include refid="page_where" />
- </update>
- <!-- 其他自定义SQL -->
- <select id="getRcrdDtoList" parameterType="cn.com.goldenwater.dcproj.param.TacExprRcmmRcrdParam" resultType="cn.com.goldenwater.dcproj.dto.TacExprRcmmRcrdDto">
- SELECT DISTINCT TO_CHAR(INTM, 'yyyy') as year,TO_CHAR(INTM, 'yyyy-MM-dd HH24:mi') as exprTm FROM TAC_EXPR_RCMM_RCRD
- where 1=1
- <if test="year != null and year != ''">
- AND TO_CHAR(INTM, 'yyyy') = #{year}
- </if>
- </select>
- <delete id="cleanRcrdByExprTime" parameterType="cn.com.goldenwater.dcproj.dto.TacExprRcmmRcrdDto">
- delete from TAC_EXPR_RCMM_RCRD where to_char(INTM, 'yyyy-MM-dd HH24:mm') = #{exprTm}
- </delete>
- <update id="updateRcrdByRcmmId" parameterType="cn.com.goldenwater.dcproj.param.TacExprRcmmRcrdParam">
- update TAC_EXPR_RCMM_RCRD set state = #{state}
- ,note = #{note}
- where EXPR_RCMM_ID = #{exprRcmmId} and state is null
- </update>
-
- <select id="countRcrdByAdCode" parameterType="cn.com.goldenwater.dcproj.param.TacExprRcmmRcrdParam" resultType="cn.com.goldenwater.dcproj.dto.TacCountDto">
- select ba.ad_code as code,ba.ad_name as name,b.role_type,(case when b.count is null then 0 else b.count end)as count from att_ad_x_base ba left join (
- select count(*) as count,a.role_type,a.code from (
- select substr(r.work_ad,1,2) as code,r.role_type,t.expr_rcmm_id from TAC_EXPR_RCMM_RCRD t left join TAC_EXPR_RCMM r on t.expr_rcmm_id = r.id
- where r.id is not null
- <if test="year != null and year != ''">
- AND TO_CHAR(t.INTM, 'yyyy') = #{year}
- </if>
- <if test="sttm != null and sttm != '' and entm != null and entm != ''">
- AND t.INTM >= TO_DATE(#{sttm},'YYYY-MM-DD') AND t.INTM < TO_DATE(#{entm},'YYYY-MM-DD')+1
- </if>
- ) a group by a.code,a.role_type
- ) b on CONCAT(SUBSTR(b.code, 0, 2), '0000000000') = ba.AD_CODE
- where ba.ad_grad = '2' order by ba.ad_code
- </select>
- <select id="getRcmmRcrdList" parameterType="cn.com.goldenwater.dcproj.param.TacExprRcmmRcrdParam" resultType="cn.com.goldenwater.dcproj.model.TacExprRcmmRcrd">
- SELECT t.ID,
- t.EXPR_RCMM_ID,
- t.STATE,
- t.NOTE,
- t.IS_SM,
- t.IS_MSG,
- t.PERS_ID,
- t.INTM,
- t.UPTM,
- t.DATA_STAT,p.PERS_NAME FROM TAC_EXPR_RCMM_RCRD t LEFT JOIN BIS_INSP_ALL_RLATION_PERS p on t.pers_id = p.guid where p.guid is not null
- <if test="exprRcmmId != null and exprRcmmId != ''">
- AND t.EXPR_RCMM_ID = #{exprRcmmId}
- </if>
- <if test="state != null and state != ''">
- AND t.STATE = #{state}
- </if>
- </select>
- </mapper>
|