123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- <?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 deletion_info(fund_id,deletion_type,deletion_date,isvalid,createtime,updatetime,is_send)
- values (#{fundId},#{deletionType},#{deletionDate},#{isvalid},#{createTime},#{updateTime},#{isSend})
- </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}
- </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>
- </update>
- <delete id="deleteDeletionRemark">
- update deletion_info set isvalid=0,updatetime=now() where isvalid=1 and fund_id=#{fundId} and deletion_type=#{deletionType}
- <if test="tradeDate != null and tradeDate !=''">
- and deletion_date=#{tradeDate}
- </if>
- </delete>
- <delete id="deleteDeletion">
- update deletion_info set isvalid=0,updatetime=now() 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 distinct
- d.fund_id,
- info.fund_name,
- c.company_name,
- d.deletion_type,
- ddn.deletion_num,
- ddp.processed_num
- FROM
- (SELECT
- de.fund_id,
- de.deletion_type,
- de.isvalid
- FROM
- deletion_info de
- WHERE de.isvalid = 1
- GROUP BY de.fund_id,
- de.deletion_type,de.isvalid) 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
- LEFT JOIN
- (SELECT
- di.fund_id,
- di.deletion_type,
- COUNT(di.fund_id) AS deletion_num
- FROM
- deletion_info di
- WHERE di.isvalid = 1
- AND di.remark IS NULL
- GROUP BY di.fund_id,
- di.deletion_type) ddn
- ON ddn.fund_id = d.fund_id
- AND d.deletion_type = ddn.deletion_type
- LEFT JOIN
- (SELECT
- dip.fund_id,
- dip.deletion_type,
- COUNT(dip.fund_id) AS processed_num
- FROM
- deletion_info dip
- WHERE dip.isvalid = 1
- AND dip.remark IS NOT NULL
- GROUP BY dip.fund_id,
- dip.deletion_type) ddp
- ON ddp.fund_id = d.fund_id
- AND d.deletion_type = ddp.deletion_type
- WHERE d.isvalid = 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 ddn.deletion_num >= #{deletionStartNum}
- </if>
- <if test="deletionEndNum != null and deletionEndNum != ''">
- and ddn.deletion_num <![CDATA[ <= ]]> #{deletionEndNum}
- </if>
- limit #{offset},#{pageSize}
- </select>
- <select id="countDeletion" resultType="java.lang.Long"
- parameterType="com.simuwang.base.pojo.dto.query.DeletionPageQuery">
- select count(1) from (select distinct
- d.fund_id,
- info.fund_name,
- c.company_name,
- d.deletion_type,
- ddn.deletion_num,
- ddp.processed_num
- FROM
- deletion_info 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
- LEFT JOIN
- (SELECT
- di.fund_id,
- di.deletion_type,
- COUNT(di.fund_id) AS deletion_num
- FROM
- deletion_info di
- WHERE di.isvalid = 1
- AND di.remark IS NULL
- GROUP BY di.fund_id,
- di.deletion_type) ddn
- ON ddn.fund_id = d.fund_id
- AND d.deletion_type = ddn.deletion_type
- LEFT JOIN
- (SELECT
- dip.fund_id,
- dip.deletion_type,
- COUNT(dip.fund_id) AS processed_num
- FROM
- deletion_info dip
- WHERE dip.isvalid = 1
- AND dip.remark IS NOT NULL
- GROUP BY dip.fund_id,
- dip.deletion_type) ddp
- ON ddp.fund_id = d.fund_id
- AND d.deletion_type = ddp.deletion_type
- WHERE d.isvalid = 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 ddn.deletion_num >= #{deletionStartNum}
- </if>
- <if test="deletionEndNum != null and deletionEndNum != ''">
- and ddn.deletion_num <![CDATA[ <= ]]> #{deletionEndNum}
- </if>) a
- </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}
- 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}
- 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 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 deletion_info where fund_id=#{fundId} and deletion_date=#{deletionDate} and deletion_type=#{deletionType} limit 1
- </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" resultType="com.simuwang.base.pojo.dos.EmailDeletionInfoDO">
- select info.fund_name,c.company_name,d.deletion_type,d.deletion_date
- 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
- 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>
- <update id="removeDistributeDeletion" parameterType="java.lang.String">
- update deletion_info set isvalid=0,updatetime=now() where fund_id=#{fundId} and remark is null
- </update>
- <update id="updateSendStatusByFundId">
- update deletion_info d set is_send=1,updatetime=now() 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 deletion_info d set isvalid=1,updatetime=now() where id=#{id}
- </update>
- </mapper>
|