DeletionInfoMapper.xml 9.4 KB

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