123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380 |
- <?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.daq.DeletionInfoMapper">
- <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.DeletionInfoDO">
- <id column="id" property="id"/>
- <result column="fund_id" property="fundId"/>
- <result column="channel_id" property="channelId"/>
- <result column="channel_name" property="channelName"/>
- <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 deletion_info(fund_id,deletion_type,deletion_date,isvalid,createtime,updatetime,is_send,channel_id)
- values (#{fundId},#{deletionType},#{deletionDate},#{isvalid},#{createTime},#{updateTime},#{isSend},#{channelId})
- </insert>
- <insert id="batchSaveDeletionInfoDO">
- insert into deletion_info(fund_id,deletion_type,deletion_date,isvalid,createtime,updatetime,is_send,channel_id)
- values
- <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
- (#{itemDo.fundId},#{itemDo.deletionType},#{itemDo.deletionDate},#{itemDo.isvalid},#{itemDo.createTime},#{itemDo.updateTime},#{itemDo.isSend},#{itemDo.channelId})
- </foreach>
- </insert>
- <insert id="saveDistributeFirstDeletion">
- insert into distribute_first_deletion_info(fund_id,deletion_date,isvalid,createtime,updatetime)
- values(#{fundId},#{deletionDate},#{isvalid},#{createTime},#{updateTime})
- </insert>
- <update id="update" parameterType="com.simuwang.base.pojo.dos.FundDeletionInfoDO">
- update 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 deletion_info
- <set>
- fund_id=#{itemDo.fundId},
- deletion_type = #{itemDo.deletionType},
- deletion_date=#{itemDo.deletionDate},
- remark=#{itemDo.remark},
- updatetime=now(),
- updaterid=#{itemDo.updaterId}
- </set>
- where isvalid = 1 and id=#{itemDo.id} and channel_id=#{itemDo.channelId}
- </foreach>
- </update>
- <update id="updateRemark">
- update 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>
- <if test="channelId != null and channelId !=''">
- and channel_id=#{channelId}
- </if>
- </update>
- <delete id="deleteDeletionRemark">
- update deletion_info set isvalid=0,updatetime=now() 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 deletion_info set isvalid=0,updatetime=now() where isvalid=1 and fund_id=#{fundId} and channel_id=#{channelId} 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,
- ci.id as channel_id,
- ci.channel_name
- FROM
- deletion_type_statistics d
- LEFT JOIN pvn_fund_info info
- ON d.fund_id = info.fund_id and info.isvalid=1
- LEFT JOIN pvn_company_info c
- ON info.trust_id = c.company_id and c.isvalid=1
- join channel_info ci
- on ci.id = d.channel_id and ci.isvalid=1
- <if test="userId != null and userId !=''">
- join user_channel_mapping ucm
- on ucm.channel_id = ci.id and ucm.isvalid=1
- </if>
- WHERE 1=1
- <if test="userId != null and userId !=''">
- and ucm.user_id =#{userId}
- </if>
- <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="channelName != null and channelName != ''">
- and ci.channel_name = #{channelName}
- </if>
- <if test="deletionEndNum != null and deletionEndNum != ''">
- and d.deletion_num <![CDATA[ <= ]]> #{deletionEndNum}
- </if>
- <choose>
- <when test="sort != null and sort !='' and sort=='lastDeletionDate' and order != null and order !=''">
- 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
- deletion_type_statistics d
- LEFT JOIN pvn_fund_info info
- ON d.fund_id = info.fund_id and info.isvalid=1
- LEFT JOIN pvn_company_info c
- ON info.trust_id = c.company_id and c.isvalid=1
- join channel_info ci
- on ci.id = d.channel_id and ci.isvalid=1
- <if test="userId != null and userId !=''">
- join user_channel_mapping ucm
- on ucm.channel_id = ci.id and ucm.isvalid=1
- </if>
- WHERE 1=1
- <if test="userId != null and userId !=''">
- and ucm.user_id =#{userId}
- </if>
- <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="channelName != null and channelName != ''">
- and ci.channel_name = #{channelName}
- </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 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
- deletion_info d
- left join 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}
- AND d.channel_id = #{channelId}
- 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
- deletion_info d
- left join 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}
- AND d.channel_id = #{channelId}
- 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,channel_id
- from 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,channel_id
- from deletion_info where fund_id=#{fundId} and deletion_type=#{deletionType} and channel_id=#{channelId} 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_id" property="fundId"/>
- <result column="fund_name" property="fundName"/>
- <result column="company_name" property="companyName"/>
- <result column="deletion_date" property="deletionDate"/>
- <result column="deletion_type" property="deletionType"/>
- <result column="channel_id" property="channelId"/>
- <result column="channel_name" property="channelName"/>
- </resultMap>
- <select id="selectDeletionInfoByFundId" resultMap="BaseEmailMap">
- select info.fund_id,info.fund_name,c.company_name,d.deletion_type,d.deletion_date,ci.id as channel_id,ci.channel_name
- from deletion_info d
- join pvn_fund_info info on d.fund_id=info.fund_id
- join pvn_company_info c on c.company_id=info.trust_id
- left join channel_info ci on ci.id=d.channel_id and ci.isvalid=1
- where d.isvalid=1 and info.isvalid=1 and c.isvalid=1 and d.remark is null and d.is_send=0
- 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_type desc,d.deletion_date desc
- </select>
- <select id="countFundDeletion" resultType="java.lang.Integer">
- select count(1) from deletion_info where isvalid=1 and fund_id =#{fundId} and remark is null
- </select>
- <select id="selectDeletionDetailByFundId" resultMap="BaseEmailMap">
- select info.fund_id,info.fund_name,c.company_name,d.deletion_type,d.deletion_date,ci.id as channel_id,ci.channel_name
- from deletion_info d
- join pvn_fund_info info on d.fund_id=info.fund_id
- left join pvn_company_info c on c.company_id=info.trust_id and c.isvalid=1
- left join channel_info ci on ci.id=d.channel_id and ci.isvalid=1
- where d.isvalid=1 and info.isvalid=1 and d.remark is null and d.is_send=0
- and d.fund_id = #{fundId}
- order by info.fund_id desc,d.deletion_type desc,d.deletion_date desc
- </select>
- <select id="getFundDeletionTypeMapList" resultType="com.simuwang.base.pojo.dos.FundDeletionTypeDO">
- SELECT fund_id as "fundId",deletion_type as "deletionType",channel_id as "channelId" from PPW_EMAIL.deletion_info where isvalid=1 group by fund_id,deletion_type,channel_id
- </select>
- <select id="countChannelFundDeletion" resultType="java.lang.Integer">
- select count(1) from PPW_EMAIL.deletion_info where isvalid=1 and fund_id=#{fundId} and deletion_type=#{deletionType} and channel_id=#{channelId}
- <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 channel_id=#{channelId} AND remark is null
- </select>
- <select id="selectNavDeletionInfoByFundId"
- resultMap="BaseEmailMap">
- select info.fund_id,info.fund_name,c.company_name,d.deletion_type,d.deletion_date,ci.id as channel_id,ci.channel_name
- from deletion_info d
- join pvn_fund_info info on d.fund_id=info.fund_id
- join pvn_company_info c on c.company_id=info.trust_id
- left join channel_info ci on ci.id=d.channel_id and ci.isvalid=1
- where d.isvalid=1 and info.isvalid=1 and c.isvalid=1 and d.remark is null and d.is_send=0
- and d.deletion_type = 1
- and d.fund_id = #{fundId}
- order by d.deletion_type,d.deletion_date desc
- </select>
- <select id="selectDistributeDeletionInfoByFundId"
- resultMap="BaseEmailMap">
- select info.fund_id,info.fund_name,c.company_name,d.deletion_type,d.deletion_date,ci.id as channel_id,ci.channel_name
- from deletion_info d
- join pvn_fund_info info on d.fund_id=info.fund_id
- join pvn_company_info c on c.company_id=info.trust_id
- left join channel_info ci on ci.id=d.channel_id and ci.isvalid=1
- where d.isvalid=1 and info.isvalid=1 and c.isvalid=1 and d.remark is null and d.is_send=0
- and d.deletion_type = 3
- and d.fund_id =#{fundId}
- order by d.deletion_date
- </select>
- <select id="getDistributeDeletionInfo" resultType="com.simuwang.base.pojo.dos.DistributeDeletionInfoDO">
- select id,fund_id as "fundId",deletion_date as "deletionDate" from distribute_first_deletion_info where fund_id=#{fundId} and isvalid=1
- </select>
- <select id="selectAssetDeletionInfoByFundId" resultMap="BaseResultMap">
- select info.fund_id,info.fund_name,c.company_name,d.deletion_type,d.deletion_date,ci.id as channel_id,ci.channel_name
- from deletion_info d
- join pvn_fund_info info on d.fund_id=info.fund_id
- join pvn_company_info c on c.company_id=info.trust_id
- left join channel_info ci on ci.id=d.channel_id and ci.isvalid=1
- where d.isvalid=1 and info.isvalid=1 and c.isvalid=1 and d.remark is null and d.is_send=0
- and d.deletion_type = 2
- and d.fund_id = #{fundId}
- order by d.deletion_type,d.deletion_date desc
- </select>
- <update id="updateSendStatusByFundId">
- update deletion_info d set d.is_send=1,d.updatetime=now() where d.isvalid=1
- and d.fund_id in
- <foreach collection="fundIdList" index="index" item="fundId" separator="," open="(" close=")">
- #{fundId}
- </foreach>
- </update>
- <update id="updateDeletionInfoDO">
- update deletion_info d set isvalid=1,updatetime=now() where id=#{id}
- </update>
- <update id="batchUpdateDeletionInfoDO">
- <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
- update deletion_info
- <set>
- fund_id=#{itemDo.fundId},
- deletion_type = #{itemDo.deletionType},
- deletion_date=#{itemDo.deletionDate},
- remark=#{itemDo.remark},
- updatetime=now(),
- 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 deletion_info set remark=#{itemDo.remark},updaterid=#{itemDo.updaterId} where isvalid=1 and remark is null and channel_id=#{itemDo.channelId}
- <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>
- <update id="updateDistributeDeletionInfoDO">
- update distribute_first_deletion_info set deletion_date=#{deletionDate},updatetime=now() where fund_id=#{fundId} and isvalid=1
- </update>
- </mapper>
|