DeletionInfoMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.simuwang.base.mapper.DeletionInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.DeletionInfoDO">
  5. <id column="id" property="id"/>
  6. <result column="fund_id" property="fundId"/>
  7. <result column="deletion_date" property="deletionDate"/>
  8. <result column="deletion_type" property="deletionType"/>
  9. <result column="company_name" property="companyName"/>
  10. <result column="fund_name" property="fundName"/>
  11. <result column="deletion_num" property="deletionNum"/>
  12. <result column="processed_num" property="processedNum"/>
  13. <result column="isvalid" property="isvalid"/>
  14. <result column="creatorid" property="creatorId"/>
  15. <result column="createtime" property="createTime"/>
  16. <result column="updaterid" property="updaterId"/>
  17. <result column="updatetime" property="updateTime"/>
  18. <result column="is_send" property="isSend"/>
  19. </resultMap>
  20. <insert id="saveDeletionInfoDO" parameterType="com.simuwang.base.pojo.dos.DeletionInfoDO">
  21. insert into PPW_EMAIL.deletion_info(fund_id,deletion_type,deletion_date,isvalid,createtime,updatetime,is_send)
  22. values (#{fundId},#{deletionType},#{deletionDate},#{isvalid},#{createTime},#{updateTime},#{isSend})
  23. </insert>
  24. <insert id="batchSaveDeletionInfoDO">
  25. insert into PPW_EMAIL.deletion_info(fund_id,deletion_type,deletion_date,isvalid,createtime,updatetime,is_send)
  26. values
  27. <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
  28. (#{itemDo.fundId},#{itemDo.deletionType},#{itemDo.deletionDate},#{itemDo.isvalid},#{itemDo.createTime},#{itemDo.updateTime},#{itemDo.isSend})
  29. </foreach>
  30. </insert>
  31. <update id="update" parameterType="com.simuwang.base.pojo.dos.FundDeletionInfoDO">
  32. update PPW_EMAIL.deletion_info set fund_id=#{fundId},deletion_type=#{deletionType},deletion_date=#{deletionDate},remark=#{remark},updatetime=#{updateTime}
  33. where id=#{id} and isvalid=1
  34. </update>
  35. <update id="batchUpdate">
  36. <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
  37. update PPW_EMAIL.deletion_info
  38. <set>
  39. fund_id=#{itemDo.fundId},
  40. deletion_type = #{itemDo.deletionType},
  41. deletion_date=#{itemDo.deletionDate},
  42. remark=#{itemDo.remark},
  43. updatetime=sysdate(),
  44. updaterid=#{itemDo.updaterId}
  45. </set>
  46. where isvalid = 1 and id=#{itemDo.id}
  47. </foreach>
  48. </update>
  49. <update id="updateRemark">
  50. update PPW_EMAIL.deletion_info set remark=#{remark},updaterid=#{updaterId} where isvalid=1 and remark is null
  51. <if test="fundId != null and fundId !=''">
  52. and fund_id=#{fundId}
  53. </if>
  54. <if test="deletionType != null and deletionType !=''">
  55. and deletion_type=#{deletionType}
  56. </if>
  57. <if test="deletionDate != null and deletionDate !=''">
  58. and deletion_date=#{deletionDate}
  59. </if>
  60. </update>
  61. <delete id="deleteDeletionRemark">
  62. update PPW_EMAIL.deletion_info set isvalid=0,updatetime=sysdate() where isvalid=1 and fund_id=#{fundId} and deletion_type=#{deletionType}
  63. and deletion_date in
  64. <foreach item="tradeDate" collection="list" open="(" separator="," close=")">
  65. #{tradeDate}
  66. </foreach>
  67. </delete>
  68. <delete id="deleteDeletion">
  69. 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
  70. </delete>
  71. <select id="searchDeletionList" resultMap="BaseResultMap"
  72. parameterType="com.simuwang.base.pojo.dto.query.DeletionPageQuery">
  73. SELECT
  74. d.fund_id,
  75. info.fund_name,
  76. c.company_name,
  77. d.deletion_type,
  78. d.deletion_num,
  79. d.processed_num,
  80. d.last_deletion_date
  81. FROM
  82. ppw_email.deletion_type_statistics d
  83. LEFT JOIN PPW_EMAIL.pvn_fund_info info
  84. ON d.fund_id = info.fund_id and info.isvalid=1
  85. LEFT JOIN PPW_EMAIL.pvn_company_info c
  86. ON info.trust_id = c.company_id and c.isvalid=1
  87. WHERE 1=1
  88. <if test="companyName != null and companyName !=''">
  89. and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
  90. </if>
  91. <if test="fundName != null and fundName !=''">
  92. and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%') or info.fund_id like concat('%',#{fundName},'%'))
  93. </if>
  94. <if test="deletionType != null and deletionType != -1">
  95. and d.deletion_type=#{deletionType}
  96. </if>
  97. <if test="deletionStartNum != null and deletionStartNum != ''">
  98. and d.deletion_num >= #{deletionStartNum}
  99. </if>
  100. <if test="deletionEndNum != null and deletionEndNum != ''">
  101. and d.deletion_num <![CDATA[ <= ]]> #{deletionEndNum}
  102. </if>
  103. <choose>
  104. <when test="sort != null and sort=='lastDeletionDate' and order != null and order =='asc'">
  105. order by d.last_deletion_date asc
  106. </when>
  107. <otherwise>
  108. order by d.last_deletion_date desc
  109. </otherwise>
  110. </choose>
  111. limit #{offset},#{pageSize}
  112. </select>
  113. <select id="countDeletion" resultType="java.lang.Long"
  114. parameterType="com.simuwang.base.pojo.dto.query.DeletionPageQuery">
  115. select count(1)
  116. FROM
  117. ppw_email.deletion_type_statistics d
  118. LEFT JOIN PPW_EMAIL.pvn_fund_info info
  119. ON d.fund_id = info.fund_id and info.isvalid=1
  120. LEFT JOIN PPW_EMAIL.pvn_company_info c
  121. ON info.trust_id = c.company_id and c.isvalid=1
  122. WHERE 1=1
  123. <if test="companyName != null and companyName !=''">
  124. and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
  125. </if>
  126. <if test="fundName != null and fundName !=''">
  127. and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%') or info.fund_id like concat('%',#{fundName},'%'))
  128. </if>
  129. <if test="deletionType != null and deletionType != -1">
  130. and d.deletion_type=#{deletionType}
  131. </if>
  132. <if test="deletionStartNum != null and deletionStartNum != ''">
  133. and d.deletion_num >= #{deletionStartNum}
  134. </if>
  135. <if test="deletionEndNum != null and deletionEndNum != ''">
  136. and d.deletion_num <![CDATA[ <= ]]> #{deletionEndNum}
  137. </if>
  138. </select>
  139. <select id="getLastDeletionDateByFundId" resultType="java.lang.String">
  140. select max(deletion_date) from PPW_EMAIL.deletion_info where fund_id=#{fundId} and deletion_type=#{deletionType}
  141. </select>
  142. <resultMap id="BaseMap" type="com.simuwang.base.pojo.dos.FundDeletionInfoDO">
  143. <id column="id" property="id"/>
  144. <result column="fund_id" property="fundId"/>
  145. <result column="fund_name" property="fundName"/>
  146. <result column="deletion_date" property="deletionDate"/>
  147. <result column="deletion_type" property="deletionType"/>
  148. <result column="remark" property="remark"/>
  149. <result column="isvalid" property="isvalid"/>
  150. <result column="creatorid" property="creatorId"/>
  151. <result column="createtime" property="createTime"/>
  152. <result column="updaterid" property="updaterId"/>
  153. <result column="updatetime" property="updateTime"/>
  154. </resultMap>
  155. <select id="searchFundDeletionList" resultMap="BaseMap"
  156. parameterType="com.simuwang.base.pojo.dto.query.FundDeletionPageQuery">
  157. SELECT
  158. d.id,
  159. d.fund_id,
  160. info.fund_name,
  161. d.deletion_type,
  162. d.deletion_date,
  163. d.remark,
  164. d.isvalid,
  165. d.creatorid,
  166. d.updaterid,
  167. d.createtime,
  168. d.updatetime
  169. FROM
  170. PPW_EMAIL.deletion_info d
  171. left join PPW_EMAIL.pvn_fund_info info
  172. on d.fund_id =info.fund_id and info.isvalid=1
  173. WHERE d.isvalid = 1
  174. AND d.fund_id = #{fundId}
  175. AND d.deletion_type = #{deletionType}
  176. ORDER BY deletion_date DESC
  177. limit #{offset},#{pageSize}
  178. </select>
  179. <select id="countFundDeletionList" resultType="java.lang.Long"
  180. parameterType="com.simuwang.base.pojo.dto.query.FundDeletionPageQuery">
  181. select count(d.id)
  182. FROM
  183. PPW_EMAIL.deletion_info d
  184. left join PPW_EMAIL.pvn_fund_info info
  185. on d.fund_id =info.fund_id and info.isvalid=1
  186. WHERE d.isvalid = 1
  187. AND d.fund_id = #{fundId}
  188. AND d.deletion_type = #{deletionType}
  189. ORDER BY deletion_date DESC
  190. </select>
  191. <select id="selectFundDeletionInfoVOList" resultType="com.simuwang.base.pojo.dos.FundDeletionInfoDO"
  192. parameterType="java.util.List">
  193. select id,fund_id,deletion_type,deletion_date,remark,isvalid,creatorid,updaterid,createtime,updatetime
  194. from PPW_EMAIL.deletion_info where isvalid=1 and remark is null
  195. <if test="fundId != null and fundId !=''">
  196. and fund_id = #{fundId}
  197. </if>
  198. <if test="deletionType != null">
  199. and deletion_type=#{deletionType}
  200. </if>
  201. order by fund_id desc,deletion_type desc ,deletion_date desc
  202. </select>
  203. <select id="getDeletionInfoDO" resultType="com.simuwang.base.pojo.dos.DeletionInfoDO"
  204. parameterType="com.simuwang.base.pojo.dos.DeletionInfoDO">
  205. select id,fund_id,deletion_type,deletion_date,remark,isvalid,creatorid,updaterid,createtime,updatetime
  206. from PPW_EMAIL.deletion_info where fund_id=#{fundId} and deletion_type=#{deletionType} and deletion_date in
  207. <foreach item="tradeDate" collection="list" open="(" separator="," close=")">
  208. #{tradeDate}
  209. </foreach>
  210. </select>
  211. <resultMap id="BaseEmailMap" type="com.simuwang.base.pojo.dos.EmailDeletionInfoDO">
  212. <result column="fund_name" property="fundName"/>
  213. <result column="company_name" property="companyName"/>
  214. <result column="deletion_date" property="deletionDate"/>
  215. <result column="deletion_type" property="deletionType"/>
  216. </resultMap>
  217. <select id="getDeletionInfoByFundId" resultMap="BaseEmailMap">
  218. select info.fund_name,c.company_name,d.deletion_type,d.deletion_date
  219. from PPW_EMAIL.deletion_info d
  220. join PPW_EMAIL.pvn_fund_info info on d.fund_id=info.fund_id
  221. join PPW_EMAIL.pvn_company_info c on c.company_id=info.trust_id
  222. where d.isvalid=1 and info.isvalid=1 and c.isvalid=1 and d.remark is null
  223. and d.fund_id in
  224. <foreach collection="fundIdList" index="index" item="fundId" separator="," open="(" close=")">
  225. #{fundId}
  226. </foreach>
  227. order by info.fund_id desc,d.deletion_date desc,d.deletion_type
  228. </select>
  229. <select id="getFundDeletionTypeMapList" resultType="com.simuwang.base.pojo.dos.FundDeletionTypeDO">
  230. SELECT fund_id as "fundId",deletion_type as "deletionType" from PPW_EMAIL.deletion_info where isvalid=1 group by fund_id,deletion_type
  231. </select>
  232. <select id="countFundDeletion" resultType="java.lang.Integer">
  233. select count(1) from PPW_EMAIL.deletion_info where isvalid=1 and fund_id=#{fundId} and deletion_type=#{deletionType}
  234. <if test="type == 1">
  235. and remark is null
  236. </if>
  237. <if test="type != 1">
  238. and remark is not null
  239. </if>
  240. </select>
  241. <select id="getLastDeletionDate" resultType="java.lang.String">
  242. select max(deletion_date) from PPW_EMAIL.deletion_info where isvalid=1 and fund_id=#{fundId} and deletion_type=#{deletionType} AND remark is null
  243. </select>
  244. <update id="removeDistributeDeletion" parameterType="java.lang.String">
  245. update PPW_EMAIL.deletion_info set isvalid=0,updatetime=sysdate() where fund_id=#{fundId} and remark is null
  246. </update>
  247. <update id="updateSendStatusByFundId">
  248. update PPW_EMAIL.deletion_info d set is_send=1,updatetime=sysdate() where isvalid=1
  249. and d.fund_id in
  250. <foreach collection="fundIdList" index="index" item="fundId" separator="," open="(" close=")">
  251. #{fundId}
  252. </foreach>
  253. </update>
  254. <update id="updateDeletionInfoDO">
  255. update PPW_EMAIL.deletion_info d set isvalid=1,updatetime=sysdate() where id=#{id}
  256. </update>
  257. <update id="batchUpdateDeletionInfoDO">
  258. <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
  259. update PPW_EMAIL.deletion_info
  260. <set>
  261. fund_id=#{itemDo.fundId},
  262. deletion_type = #{itemDo.deletionType},
  263. deletion_date=#{itemDo.deletionDate},
  264. remark=#{itemDo.remark},
  265. updatetime=sysdate(),
  266. isvalid=#{itemDo.isvalid},
  267. updaterid=#{itemDo.updaterId}
  268. </set>
  269. where id=#{itemDo.id}
  270. </foreach>
  271. </update>
  272. <update id="batchUpdateRemark">
  273. <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
  274. update PPW_EMAIL.deletion_info set remark=#{itemDo.remark},updaterid=#{itemDo.updaterId} where isvalid=1 and remark is null
  275. <if test="itemDo.fundId != null and itemDo.fundId !=''">
  276. and fund_id=#{itemDo.fundId}
  277. </if>
  278. <if test="itemDo.deletionType != null and itemDo.deletionType !=''">
  279. and deletion_type=#{itemDo.deletionType}
  280. </if>
  281. <if test="itemDo.deletionDate != null and itemDo.deletionDate !=''">
  282. and deletion_date=#{itemDo.deletionDate}
  283. </if>
  284. </foreach>
  285. </update>
  286. </mapper>