DeletionInfoMapper.xml 9.2 KB

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