DeletionInfoMapper.xml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. </resultMap>
  19. <update id="update" parameterType="com.simuwang.base.pojo.dos.FundDeletionInfoDO">
  20. update PPW_EMAIL.deletion_info set fund_id=#{fundId},deletion_type=#{deletionType},deletion_date=#{deletionDate},remark=#{remark},updatetime=#{updateTime}
  21. where id=#{id} and isvalid=1
  22. </update>
  23. <update id="batchUpdate">
  24. <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
  25. update PPW_EMAIL.deletion_info
  26. <set>
  27. fund_id=#{itemDo.fundId},
  28. deletion_type = #{itemDo.deletionType},
  29. deletion_date=#{itemDo.deletionDate},
  30. remark=#{itemDo.remark},
  31. updatetime=#{itemDo.updateTime}
  32. </set>
  33. where isvalid = 1 and id=#{itemDo.id}
  34. </foreach>
  35. </update>
  36. <update id="updateRemark">
  37. update PPW_EMAIL.deletion_info set remark=#{remark} where fund_id=#{fundId} and deletion_type=#{deletionType} and isvalid=1
  38. </update>
  39. <select id="searchDeletionList" resultMap="BaseResultMap"
  40. parameterType="com.simuwang.base.pojo.dto.query.DeletionPageQuery">
  41. SELECT
  42. d.fund_id,
  43. info.fund_name,
  44. c.company_name,
  45. d.deletion_type,
  46. ddn.deletion_num,
  47. ddp.processed_num
  48. FROM
  49. PPW_EMAIL.deletion_info d
  50. JOIN PPW_EMAIL.pvn_fund_info info
  51. ON d.fund_id = info.fund_id
  52. JOIN PPW_EMAIL.pvn_company_info c
  53. ON info.trust_id = c.company_id
  54. LEFT JOIN
  55. (SELECT
  56. di.fund_id,
  57. di.deletion_type,
  58. COUNT(di.fund_id) AS deletion_num
  59. FROM
  60. PPW_EMAIL.deletion_info di
  61. WHERE di.isvalid = 1
  62. AND di.remark IS NULL
  63. GROUP BY di.fund_id,
  64. di.deletion_type) ddn
  65. ON ddn.fund_id = d.fund_id
  66. AND d.deletion_type = ddn.deletion_type
  67. LEFT JOIN
  68. (SELECT
  69. dip.fund_id,
  70. dip.deletion_type,
  71. COUNT(dip.fund_id) AS processed_num
  72. FROM
  73. PPW_EMAIL.deletion_info dip
  74. WHERE dip.isvalid = 1
  75. AND dip.remark IS NOT NULL
  76. GROUP BY dip.fund_id,
  77. dip.deletion_type) ddp
  78. ON ddp.fund_id = d.fund_id
  79. AND d.deletion_type = ddp.deletion_type
  80. WHERE d.isvalid = 1
  81. AND info.isvalid = 1
  82. AND c.isvalid = 1
  83. <if test="companyName != null and companyName !=''">
  84. and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
  85. </if>
  86. <if test="fundName != null and fundName !=''">
  87. and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%'))
  88. </if>
  89. <if test="deletionType != null and deletionType != -1">
  90. and d.deletion_type=#{deletionType}
  91. </if>
  92. <if test="deletionStartNum != null and deletionStartNum != ''">
  93. and ddn.deletion_num >= #{deletionStartNum}
  94. </if>
  95. <if test="deletionEndNum != null and deletionEndNum != ''">
  96. and ddn.deletion_num <![CDATA[ <= ]]> #{deletionEndNum}
  97. </if>
  98. group by d.fund_id,d.deletion_type
  99. limit #{offset},#{pageSize}
  100. </select>
  101. <select id="countDeletion" resultType="java.lang.Long"
  102. parameterType="com.simuwang.base.pojo.dto.query.DeletionPageQuery">
  103. select count(1) from (select distinct d.fund_id,d.deletion_type
  104. FROM
  105. PPW_EMAIL.deletion_info d
  106. JOIN PPW_EMAIL.pvn_fund_info info
  107. ON d.fund_id = info.fund_id
  108. JOIN PPW_EMAIL.pvn_company_info c
  109. ON info.trust_id = c.company_id
  110. LEFT JOIN
  111. (SELECT
  112. di.fund_id,
  113. di.deletion_type,
  114. COUNT(di.fund_id) AS deletion_num
  115. FROM
  116. PPW_EMAIL.deletion_info di
  117. WHERE di.isvalid = 1
  118. AND di.remark IS NULL
  119. GROUP BY di.fund_id,
  120. di.deletion_type) ddn
  121. ON ddn.fund_id = d.fund_id
  122. AND d.deletion_type = ddn.deletion_type
  123. LEFT JOIN
  124. (SELECT
  125. dip.fund_id,
  126. dip.deletion_type,
  127. COUNT(dip.fund_id) AS processed_num
  128. FROM
  129. PPW_EMAIL.deletion_info dip
  130. WHERE dip.isvalid = 1
  131. AND dip.remark IS NOT NULL
  132. GROUP BY dip.fund_id,
  133. dip.deletion_type) ddp
  134. ON ddp.fund_id = d.fund_id
  135. AND d.deletion_type = ddp.deletion_type
  136. WHERE d.isvalid = 1
  137. AND info.isvalid = 1
  138. AND c.isvalid = 1
  139. <if test="companyName != null and companyName !=''">
  140. and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
  141. </if>
  142. <if test="fundName != null and fundName !=''">
  143. and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%'))
  144. </if>
  145. <if test="deletionType != null and deletionType != -1">
  146. and d.deletion_type=#{deletionType}
  147. </if>
  148. <if test="deletionStartNum != null and deletionStartNum != ''">
  149. and ddn.deletion_num >= #{deletionStartNum}
  150. </if>
  151. <if test="deletionEndNum != null and deletionEndNum != ''">
  152. and ddn.deletion_num <![CDATA[ <= ]]> #{deletionEndNum}
  153. </if>
  154. group by d.fund_id,d.deletion_type) a
  155. </select>
  156. <select id="getLastDeletionDateByFundId" resultType="java.lang.String">
  157. select max(deletion_date) from PPW_EMAIL.deletion_info where fund_id=#{fundId} and deletion_type=#{deletionType}
  158. </select>
  159. <resultMap id="BaseMap" type="com.simuwang.base.pojo.dos.FundDeletionInfoDO">
  160. <id column="id" property="id"/>
  161. <result column="fund_id" property="fundId"/>
  162. <result column="deletion_date" property="deletionDate"/>
  163. <result column="deletion_type" property="deletionType"/>
  164. <result column="remark" property="remark"/>
  165. <result column="isvalid" property="isvalid"/>
  166. <result column="creatorid" property="creatorId"/>
  167. <result column="createtime" property="createTime"/>
  168. <result column="updaterid" property="updaterId"/>
  169. <result column="updatetime" property="updateTime"/>
  170. </resultMap>
  171. <select id="searchFundDeletionList" resultMap="BaseMap"
  172. parameterType="com.simuwang.base.pojo.dto.query.FundDeletionPageQuery">
  173. select id,fund_id,deletion_type,deletion_date,remark,isvalid,creatorid,updaterid,createtime,updatetime
  174. from PPW_EMAIL.deletion_info where isvalid=1 and fund_id=#{fundId} and remark is null
  175. limit #{offset},#{pageSize}
  176. </select>
  177. <select id="countFundDeletionList" resultType="java.lang.Long"
  178. parameterType="com.simuwang.base.pojo.dto.query.FundDeletionPageQuery">
  179. select count(1)
  180. from PPW_EMAIL.deletion_info where isvalid=1 and fund_id=#{fundId} and remark is null
  181. </select>
  182. <select id="selectFundDeletionInfoVOList" resultType="com.simuwang.base.pojo.dos.FundDeletionInfoDO"
  183. parameterType="java.util.List">
  184. select id,fund_id,deletion_type,deletion_date,remark,isvalid,creatorid,updaterid,createtime,updatetime
  185. from PPW_EMAIL.deletion_info where isvalid=1 and remark is null
  186. <if test="fundIdList.size() > 0">
  187. and fund_id in
  188. <foreach collection="fundIdList" index="index" item="fundId" separator="," open="(" close=")">
  189. #{fundId}
  190. </foreach>
  191. </if>
  192. </select>
  193. </mapper>