123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- <?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="com.simuwang.base.mapper.DeletionInfoMapper">
- <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.DeletionInfoDO">
- <id column="id" property="id"/>
- <result column="fund_id" property="fundId"/>
- <result column="deletion_date" property="deletionDate"/>
- <result column="deletion_type" property="deletionType"/>
- <result column="company_name" property="companyName"/>
- <result column="fund_name" property="fundName"/>
- <result column="deletion_num" property="deletionNum"/>
- <result column="processed_num" property="processedNum"/>
- <result column="isvalid" property="isvalid"/>
- <result column="creatorid" property="creatorId"/>
- <result column="createtime" property="createTime"/>
- <result column="updaterid" property="updaterId"/>
- <result column="updatetime" property="updateTime"/>
- <result column="is_send" property="isSend"/>
- </resultMap>
- <insert id="saveDeletionInfoDO" parameterType="com.simuwang.base.pojo.dos.DeletionInfoDO">
- insert into PPW_EMAIL.deletion_info(fund_id,deletion_type,deletion_date,isvalid,createtime,updatetime,is_send)
- values (#{fundId},#{deletionType},#{deletionDate},#{isvalid},#{createTime},#{updateTime},#{isSend})
- </insert>
- <insert id="batchSaveDeletionInfoDO">
- insert into PPW_EMAIL.deletion_info(fund_id,deletion_type,deletion_date,isvalid,createtime,updatetime,is_send)
- values
- <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
- (#{itemDo.fundId},#{itemDo.deletionType},#{itemDo.deletionDate},#{itemDo.isvalid},#{itemDo.createTime},#{itemDo.updateTime},#{itemDo.isSend})
- </foreach>
- </insert>
- <update id="update" parameterType="com.simuwang.base.pojo.dos.FundDeletionInfoDO">
- update PPW_EMAIL.deletion_info set fund_id=#{fundId},deletion_type=#{deletionType},deletion_date=#{deletionDate},remark=#{remark},updatetime=#{updateTime}
- where id=#{id} and isvalid=1
- </update>
- <update id="batchUpdate">
- <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
- update PPW_EMAIL.deletion_info
- <set>
- fund_id=#{itemDo.fundId},
- deletion_type = #{itemDo.deletionType},
- deletion_date=#{itemDo.deletionDate},
- remark=#{itemDo.remark},
- updatetime=sysdate(),
- updaterid=#{itemDo.updaterId}
- </set>
- where isvalid = 1 and id=#{itemDo.id}
- </foreach>
- </update>
- <update id="updateRemark">
- update PPW_EMAIL.deletion_info set remark=#{remark},updaterid=#{updaterId} where isvalid=1 and remark is null
- <if test="fundId != null and fundId !=''">
- and fund_id=#{fundId}
- </if>
- <if test="deletionType != null and deletionType !=''">
- and deletion_type=#{deletionType}
- </if>
- <if test="deletionDate != null and deletionDate !=''">
- and deletion_date=#{deletionDate}
- </if>
- </update>
- <delete id="deleteDeletionRemark">
- update PPW_EMAIL.deletion_info set isvalid=0,updatetime=sysdate() where isvalid=1 and fund_id=#{fundId} and deletion_type=#{deletionType}
- and deletion_date in
- <foreach item="tradeDate" collection="list" open="(" separator="," close=")">
- #{tradeDate}
- </foreach>
- </delete>
- <delete id="deleteDeletion">
- update PPW_EMAIL.deletion_info set isvalid=0,updatetime=sysdate() where isvalid=1 and fund_id=#{fundId} and deletion_type=#{deletionType} and remark is null
- </delete>
- <select id="searchDeletionList" resultMap="BaseResultMap"
- parameterType="com.simuwang.base.pojo.dto.query.DeletionPageQuery">
- SELECT
- d.fund_id,
- info.fund_name,
- c.company_name,
- d.deletion_type,
- d.deletion_num,
- d.processed_num,
- d.last_deletion_date
- FROM
- ppw_email.deletion_type_statistics d
- LEFT JOIN PPW_EMAIL.pvn_fund_info info
- ON d.fund_id = info.fund_id and info.isvalid=1
- LEFT JOIN PPW_EMAIL.pvn_company_info c
- ON info.trust_id = c.company_id and c.isvalid=1
- WHERE 1=1
- <if test="companyName != null and companyName !=''">
- and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
- </if>
- <if test="fundName != null and fundName !=''">
- and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%') or info.fund_id like concat('%',#{fundName},'%'))
- </if>
- <if test="deletionType != null and deletionType != -1">
- and d.deletion_type=#{deletionType}
- </if>
- <if test="deletionStartNum != null and deletionStartNum != ''">
- and d.deletion_num >= #{deletionStartNum}
- </if>
- <if test="deletionEndNum != null and deletionEndNum != ''">
- and d.deletion_num <![CDATA[ <= ]]> #{deletionEndNum}
- </if>
- <choose>
- <when test="sort != null and sort=='lastDeletionDate' and order != null and order =='asc'">
- order by d.last_deletion_date asc
- </when>
- <otherwise>
- order by d.last_deletion_date desc
- </otherwise>
- </choose>
- limit #{offset},#{pageSize}
- </select>
- <select id="countDeletion" resultType="java.lang.Long"
- parameterType="com.simuwang.base.pojo.dto.query.DeletionPageQuery">
- select count(1)
- FROM
- ppw_email.deletion_type_statistics d
- LEFT JOIN PPW_EMAIL.pvn_fund_info info
- ON d.fund_id = info.fund_id and info.isvalid=1
- LEFT JOIN PPW_EMAIL.pvn_company_info c
- ON info.trust_id = c.company_id and c.isvalid=1
- WHERE 1=1
- <if test="companyName != null and companyName !=''">
- and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
- </if>
- <if test="fundName != null and fundName !=''">
- and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%') or info.fund_id like concat('%',#{fundName},'%'))
- </if>
- <if test="deletionType != null and deletionType != -1">
- and d.deletion_type=#{deletionType}
- </if>
- <if test="deletionStartNum != null and deletionStartNum != ''">
- and d.deletion_num >= #{deletionStartNum}
- </if>
- <if test="deletionEndNum != null and deletionEndNum != ''">
- and d.deletion_num <![CDATA[ <= ]]> #{deletionEndNum}
- </if>
- </select>
- <select id="getLastDeletionDateByFundId" resultType="java.lang.String">
- select max(deletion_date) from PPW_EMAIL.deletion_info where fund_id=#{fundId} and deletion_type=#{deletionType}
- </select>
- <resultMap id="BaseMap" type="com.simuwang.base.pojo.dos.FundDeletionInfoDO">
- <id column="id" property="id"/>
- <result column="fund_id" property="fundId"/>
- <result column="fund_name" property="fundName"/>
- <result column="deletion_date" property="deletionDate"/>
- <result column="deletion_type" property="deletionType"/>
- <result column="remark" property="remark"/>
- <result column="isvalid" property="isvalid"/>
- <result column="creatorid" property="creatorId"/>
- <result column="createtime" property="createTime"/>
- <result column="updaterid" property="updaterId"/>
- <result column="updatetime" property="updateTime"/>
- </resultMap>
- <select id="searchFundDeletionList" resultMap="BaseMap"
- parameterType="com.simuwang.base.pojo.dto.query.FundDeletionPageQuery">
- SELECT
- d.id,
- d.fund_id,
- info.fund_name,
- d.deletion_type,
- d.deletion_date,
- d.remark,
- d.isvalid,
- d.creatorid,
- d.updaterid,
- d.createtime,
- d.updatetime
- FROM
- PPW_EMAIL.deletion_info d
- left join PPW_EMAIL.pvn_fund_info info
- on d.fund_id =info.fund_id and info.isvalid=1
- WHERE d.isvalid = 1
- AND d.fund_id = #{fundId}
- AND d.deletion_type = #{deletionType}
- ORDER BY deletion_date DESC
- limit #{offset},#{pageSize}
- </select>
- <select id="countFundDeletionList" resultType="java.lang.Long"
- parameterType="com.simuwang.base.pojo.dto.query.FundDeletionPageQuery">
- select count(d.id)
- FROM
- PPW_EMAIL.deletion_info d
- left join PPW_EMAIL.pvn_fund_info info
- on d.fund_id =info.fund_id and info.isvalid=1
- WHERE d.isvalid = 1
- AND d.fund_id = #{fundId}
- AND d.deletion_type = #{deletionType}
- ORDER BY deletion_date DESC
- </select>
- <select id="selectFundDeletionInfoVOList" resultType="com.simuwang.base.pojo.dos.FundDeletionInfoDO"
- parameterType="java.util.List">
- select id,fund_id,deletion_type,deletion_date,remark,isvalid,creatorid,updaterid,createtime,updatetime
- from PPW_EMAIL.deletion_info where isvalid=1 and remark is null
- <if test="fundId != null and fundId !=''">
- and fund_id = #{fundId}
- </if>
- <if test="deletionType != null">
- and deletion_type=#{deletionType}
- </if>
- order by fund_id desc,deletion_type desc ,deletion_date desc
- </select>
- <select id="getDeletionInfoDO" resultType="com.simuwang.base.pojo.dos.DeletionInfoDO"
- parameterType="com.simuwang.base.pojo.dos.DeletionInfoDO">
- select id,fund_id,deletion_type,deletion_date,remark,isvalid,creatorid,updaterid,createtime,updatetime
- from PPW_EMAIL.deletion_info where fund_id=#{fundId} and deletion_type=#{deletionType} and deletion_date in
- <foreach item="tradeDate" collection="list" open="(" separator="," close=")">
- #{tradeDate}
- </foreach>
- </select>
- <resultMap id="BaseEmailMap" type="com.simuwang.base.pojo.dos.EmailDeletionInfoDO">
- <result column="fund_name" property="fundName"/>
- <result column="company_name" property="companyName"/>
- <result column="deletion_date" property="deletionDate"/>
- <result column="deletion_type" property="deletionType"/>
- </resultMap>
- <select id="getDeletionInfoByFundId" resultMap="BaseEmailMap">
- select info.fund_name,c.company_name,d.deletion_type,d.deletion_date
- from PPW_EMAIL.deletion_info d
- join PPW_EMAIL.pvn_fund_info info on d.fund_id=info.fund_id
- join PPW_EMAIL.pvn_company_info c on c.company_id=info.trust_id
- where d.isvalid=1 and info.isvalid=1 and c.isvalid=1 and d.remark is null
- and d.fund_id in
- <foreach collection="fundIdList" index="index" item="fundId" separator="," open="(" close=")">
- #{fundId}
- </foreach>
- order by info.fund_id desc,d.deletion_date desc,d.deletion_type
- </select>
- <select id="getFundDeletionTypeMapList" resultType="com.simuwang.base.pojo.dos.FundDeletionTypeDO">
- SELECT fund_id as "fundId",deletion_type as "deletionType" from PPW_EMAIL.deletion_info where isvalid=1 group by fund_id,deletion_type
- </select>
- <select id="countFundDeletion" resultType="java.lang.Integer">
- select count(1) from PPW_EMAIL.deletion_info where isvalid=1 and fund_id=#{fundId} and deletion_type=#{deletionType}
- <if test="type == 1">
- and remark is null
- </if>
- <if test="type != 1">
- and remark is not null
- </if>
- </select>
- <select id="getLastDeletionDate" resultType="java.lang.String">
- select max(deletion_date) from PPW_EMAIL.deletion_info where isvalid=1 and fund_id=#{fundId} and deletion_type=#{deletionType} AND remark is null
- </select>
- <update id="removeDistributeDeletion" parameterType="java.lang.String">
- update PPW_EMAIL.deletion_info set isvalid=0,updatetime=sysdate() where fund_id=#{fundId} and remark is null
- </update>
- <update id="updateSendStatusByFundId">
- update PPW_EMAIL.deletion_info d set is_send=1,updatetime=sysdate() where isvalid=1
- and d.fund_id in
- <foreach collection="fundIdList" index="index" item="fundId" separator="," open="(" close=")">
- #{fundId}
- </foreach>
- </update>
- <update id="updateDeletionInfoDO">
- update PPW_EMAIL.deletion_info d set isvalid=1,updatetime=sysdate() where id=#{id}
- </update>
- <update id="batchUpdateDeletionInfoDO">
- <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
- update PPW_EMAIL.deletion_info
- <set>
- fund_id=#{itemDo.fundId},
- deletion_type = #{itemDo.deletionType},
- deletion_date=#{itemDo.deletionDate},
- remark=#{itemDo.remark},
- updatetime=sysdate(),
- isvalid=#{itemDo.isvalid},
- updaterid=#{itemDo.updaterId}
- </set>
- where id=#{itemDo.id}
- </foreach>
- </update>
- <update id="batchUpdateRemark">
- <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
- update PPW_EMAIL.deletion_info set remark=#{itemDo.remark},updaterid=#{itemDo.updaterId} where isvalid=1 and remark is null
- <if test="itemDo.fundId != null and itemDo.fundId !=''">
- and fund_id=#{itemDo.fundId}
- </if>
- <if test="itemDo.deletionType != null and itemDo.deletionType !=''">
- and deletion_type=#{itemDo.deletionType}
- </if>
- <if test="itemDo.deletionDate != null and itemDo.deletionDate !=''">
- and deletion_date=#{itemDo.deletionDate}
- </if>
- </foreach>
- </update>
- </mapper>
|