1
0

EmailFundAssetMapper.xml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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.EmailFundAssetMapper">
  4. <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailFundAssetDO">
  5. <id column="id" property="id"/>
  6. <result column="file_id" property="fileId"/>
  7. <result column="fund_id" property="fundId"/>
  8. <result column="fund_name" property="fundName"/>
  9. <result column="register_number" property="registerNumber"/>
  10. <result column="price_date" property="priceDate"/>
  11. <result column="asset_net" property="assetNet"/>
  12. <result column="asset_share" property="assetShare"/>
  13. <result column="is_stored" property="isStored"/>
  14. <result column="exception_status" property="exceptionStatus"/>
  15. <result column="isvalid" property="isvalid"/>
  16. <result column="creatorid" property="creatorId"/>
  17. <result column="createtime" property="createTime"/>
  18. <result column="updaterid" property="updaterId"/>
  19. <result column="updatetime" property="updateTime"/>
  20. <result column="email_title" property="emailTitle"/>
  21. <result column="email_id" property="emailId"/>
  22. </resultMap>
  23. <insert id="batchInsert" parameterType="com.simuwang.base.pojo.dos.EmailFundAssetDO">
  24. insert into PPW_EMAIL.email_fund_asset(file_id, fund_id, fund_name,register_number,price_date,asset_net,asset_share,is_stored,exception_status,
  25. isvalid, creatorid, createtime, updaterid, updatetime)
  26. values
  27. <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
  28. (#{itemDo.fileId},#{itemDo.fundId},#{itemDo.fundName},#{itemDo.registerNumber},#{itemDo.priceDate},#{itemDo.assetNet},#{itemDo.assetShare},#{itemDo.isStored},#{itemDo.exceptionStatus},
  29. #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
  30. </foreach>
  31. </insert>
  32. <update id="batchUpdate">
  33. <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
  34. update PPW_EMAIL.email_fund_asset
  35. <set>
  36. fund_id = #{itemDo.fundId},
  37. exception_status = #{itemDo.exceptionStatus},
  38. updatetime=#{itemDo.updateTime},
  39. is_stored=#{itemDo.isStored}
  40. </set>
  41. where isvalid = 1
  42. and id = #{itemDo.id}
  43. </foreach>
  44. </update>
  45. <select id="searchAssetDetail" resultMap="BaseResultMap"
  46. parameterType="com.simuwang.base.pojo.dto.query.ParseDetailPageQuery">
  47. select distinct asset.id,
  48. asset.fund_id,
  49. asset.fund_name,
  50. asset.register_number,
  51. asset.price_date,
  52. asset.asset_net,
  53. asset.asset_share,
  54. asset.is_stored,
  55. asset.exception_status,
  56. asset.updatetime,
  57. parse.email_title,
  58. parse.id as email_id
  59. from PPW_EMAIL.email_fund_asset asset
  60. join PPW_EMAIL.email_file_info file
  61. on asset.file_id = file.id
  62. join PPW_EMAIL.email_parse_info parse
  63. on file.email_id = parse.id
  64. where asset.isvalid=1 and file.isvalid=1 and parse.isvalid=1
  65. <if test="fundName != null and fundName !=''">
  66. and asset.fund_name like concat('%',#{fundName},'%')
  67. </if>
  68. <if test="priceStartDate != null and priceStartDate !=''">
  69. and asset.price_date >= #{priceStartDate}
  70. </if>
  71. <if test="priceEndDate != null and priceEndDate !=''">
  72. and asset.price_date <![CDATA[ <= ]]> #{priceEndDate}
  73. </if>
  74. <if test="updateStartDate != null and updateStartDate !=''">
  75. and asset.updatetime <![CDATA[ >= ]]> #{updateStartDate}
  76. </if>
  77. <if test="updateEndDate != null and updateEndDate !=''">
  78. and asset.updatetime <![CDATA[ <= ]]> #{updateEndDate}
  79. </if>
  80. <if test="isStore != null">
  81. and asset.is_stored = #{isStore}
  82. </if>
  83. <if test="emailTitle != null and emailTitle != ''">
  84. and parse.email_title like concat('%',#{emailTitle},'%')
  85. </if>
  86. <if test="emailId != null">
  87. and parse.id =#{emailId}
  88. </if>
  89. <if test="exceptionStatusList != null">
  90. and asset.exception_status in
  91. <foreach collection="exceptionStatusList" index="index" item="exceptionStatus" separator="," open="(" close=")">
  92. #{exceptionStatus}
  93. </foreach>
  94. </if>
  95. order by asset.updatetime desc
  96. limit #{offset},#{pageSize}
  97. </select>
  98. <select id="countAssetDetail" resultType="java.lang.Long"
  99. parameterType="com.simuwang.base.pojo.dto.query.ParseDetailPageQuery">
  100. select count(1) from (
  101. select distinct asset.id
  102. from PPW_EMAIL.email_fund_asset asset
  103. join PPW_EMAIL.email_file_info file
  104. on asset.file_id = file.id
  105. join PPW_EMAIL.email_parse_info parse
  106. on file.email_id = parse.id
  107. where asset.isvalid=1 and file.isvalid=1 and parse.isvalid=1
  108. <if test="fundName != null and fundName !=''">
  109. and asset.fund_name like concat('%',#{fundName},'%')
  110. </if>
  111. <if test="priceStartDate != null and priceStartDate !=''">
  112. and asset.price_date >= #{priceStartDate}
  113. </if>
  114. <if test="priceEndDate != null and priceEndDate !=''">
  115. and asset.price_date <![CDATA[ <= ]]> #{priceEndDate}
  116. </if>
  117. <if test="updateStartDate != null and updateStartDate !=''">
  118. and asset.updatetime <![CDATA[ >= ]]> #{updateStartDate}
  119. </if>
  120. <if test="updateEndDate != null and updateEndDate !=''">
  121. and asset.updatetime <![CDATA[ <= ]]> #{updateEndDate}
  122. </if>
  123. <if test="isStore != null">
  124. and asset.is_stored = #{isStore}
  125. </if>
  126. <if test="emailTitle != null and emailTitle != ''">
  127. and parse.email_title like concat('%',#{emailTitle},'%')
  128. </if>
  129. <if test="emailId != null">
  130. and parse.id =#{emailId}
  131. </if>
  132. <if test="exceptionStatusList != null">
  133. and asset.exception_status in
  134. <foreach collection="exceptionStatusList" index="index" item="exceptionStatus" separator="," open="(" close=")">
  135. #{exceptionStatus}
  136. </foreach>
  137. </if>
  138. )a
  139. </select>
  140. <select id="countNoStoreAsset" resultType="java.lang.Integer" parameterType="java.lang.String">
  141. select count(id)
  142. from PPW_EMAIL.email_fund_asset
  143. where isvalid =1 and exception_status=3
  144. and fund_name=#{fundName}
  145. </select>
  146. <select id="selectNotMappingAsset" resultMap="BaseResultMap"
  147. parameterType="java.lang.String">
  148. select distinct id,fund_id,file_id, fund_name,register_number,price_date,asset_net,asset_share,is_stored,exception_status,
  149. updatetime
  150. from PPW_EMAIL.email_fund_asset
  151. where isvalid =1 and exception_status=3
  152. and fund_name=#{fundName}
  153. </select>
  154. <resultMap id="BaseDetailMap" type="com.simuwang.base.pojo.dos.EmailParseDetailDO">
  155. <result column="fund_id" property="fundId"/>
  156. <result column="fund_name" property="fundName"/>
  157. <result column="register_number" property="registerNumber"/>
  158. <result column="price_date" property="priceDate"/>
  159. <result column="nav" property="nav"/>
  160. <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
  161. <result column="asset_net" property="assetNet"/>
  162. <result column="asset_share" property="assetShare"/>
  163. <result column="nav_is_stored" property="navIsStored"/>
  164. <result column="nav_exception_status" property="navExceptionStatus"/>
  165. <result column="asset_is_stored" property="assetIsStored"/>
  166. <result column="asset_exception_status" property="assetExceptionStatus"/>
  167. <result column="updatetime" property="updateTime"/>
  168. </resultMap>
  169. <select id="selectFundAssetByFielId" resultMap="BaseDetailMap">
  170. SELECT DISTINCT
  171. asset.fund_id,
  172. asset.fund_name,
  173. asset.register_number,
  174. asset.price_date,
  175. null as nav,
  176. null as cumulative_nav_withdrawal,
  177. asset.asset_net as asset_net,
  178. asset.asset_share as asset_share,
  179. null AS nav_is_stored,
  180. null AS nav_exception_status,
  181. asset.is_stored as asset_is_stored,
  182. asset.exception_status as asset_exception_status,
  183. asset.updatetime
  184. FROM
  185. PPW_EMAIL.EMAIL_FILE_INFO efi
  186. JOIN PPW_EMAIL.email_fund_asset asset
  187. ON efi.id = asset.file_id
  188. AND asset.isvalid = 1
  189. WHERE efi.isvalid = 1
  190. AND efi.id = #{fileId} and asset.price_date=#{priceDate}
  191. </select>
  192. <delete id="deleteByFileId">
  193. update PPW_EMAIL.email_fund_asset
  194. set isvalid = 0,
  195. updatetime= now()
  196. where isvalid = 1
  197. and file_id = #{fileId}
  198. </delete>
  199. </mapper>