EmailFundAssetMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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.daq.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. <result column="target_fund_name" property="targetFundName"/>
  23. <result column="target_fund_id" property="targetFundId"/>
  24. <result column="channel_id" property="channelId"/>
  25. <result column="channel_name" property="channelName"/>
  26. <result column="email" property="email"/>
  27. </resultMap>
  28. <insert id="batchInsert" parameterType="com.simuwang.base.pojo.dos.EmailFundAssetDO">
  29. insert into email_fund_asset(file_id, fund_id, fund_name,register_number,price_date,asset_net,asset_share,is_stored,exception_status,
  30. isvalid, creatorid, createtime, updaterid, updatetime,channel_id)
  31. values
  32. <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
  33. (#{itemDo.fileId},#{itemDo.fundId},#{itemDo.fundName},#{itemDo.registerNumber},#{itemDo.priceDate},#{itemDo.assetNet},#{itemDo.assetShare},#{itemDo.isStored},#{itemDo.exceptionStatus},
  34. #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime}, #{itemDo.channelId})
  35. </foreach>
  36. </insert>
  37. <update id="batchUpdate">
  38. <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
  39. update email_fund_asset
  40. <set>
  41. fund_id = #{itemDo.fundId},
  42. exception_status = #{itemDo.exceptionStatus},
  43. updatetime=#{itemDo.updateTime},
  44. is_stored=#{itemDo.isStored}
  45. </set>
  46. where isvalid = 1
  47. and id = #{itemDo.id}
  48. </foreach>
  49. </update>
  50. <select id="searchAssetDetail" resultMap="BaseResultMap"
  51. parameterType="com.simuwang.base.pojo.dto.query.ParseDetailPageQuery">
  52. select distinct asset.id,
  53. asset.fund_id,
  54. asset.fund_name,
  55. info.fund_id as target_fund_id,
  56. info.fund_name as target_fund_name,
  57. asset.register_number,
  58. asset.price_date,
  59. asset.asset_net,
  60. asset.asset_share,
  61. asset.is_stored,
  62. asset.exception_status,
  63. asset.updatetime,
  64. parse.email_title,
  65. parse.id as email_id,
  66. parse.email as email,
  67. c.id as channel_id,
  68. c.channel_name as channel_name
  69. from email_fund_asset asset
  70. join email_file_info file
  71. on asset.file_id = file.id
  72. join email_parse_info parse
  73. on file.email_id = parse.id
  74. left join pvn_fund_info info
  75. on asset.fund_id=info.fund_id and info.isvalid=1
  76. left join channel_info c
  77. on asset.channel_id=c.id and c.isvalid=1
  78. where asset.isvalid=1 and file.isvalid=1 and parse.isvalid=1
  79. <if test="fundName != null and fundName !=''">
  80. and (asset.fund_name like concat('%',#{fundName},'%') or asset.register_number like concat('%',#{fundName},'%'))
  81. </if>
  82. <if test="priceStartDate != null and priceStartDate !=''">
  83. and asset.price_date >= #{priceStartDate}
  84. </if>
  85. <if test="priceEndDate != null and priceEndDate !=''">
  86. and asset.price_date <![CDATA[ <= ]]> #{priceEndDate}
  87. </if>
  88. <if test="updateStartDate != null and updateStartDate !=''">
  89. and asset.updatetime <![CDATA[ >= ]]> #{updateStartDate}
  90. </if>
  91. <if test="updateEndDate != null and updateEndDate !=''">
  92. and asset.updatetime <![CDATA[ <= ]]> #{updateEndDate}
  93. </if>
  94. <if test="isStore != null">
  95. and asset.is_stored = #{isStore}
  96. </if>
  97. <if test="emailTitle != null and emailTitle != ''">
  98. and parse.email_title like concat('%',#{emailTitle},'%')
  99. </if>
  100. <if test="emailId != null and emailId !=''">
  101. and parse.id =#{emailId}
  102. </if>
  103. <if test="email != null and email !=''">
  104. and parse.email like concat('%',#{email},'%')
  105. </if>
  106. <if test="channelName != null and channelName !=''">
  107. and c.channel_name like concat('%',#{channelName},'%')
  108. </if>
  109. <if test="exceptionStatusList != null">
  110. and asset.exception_status in
  111. <foreach collection="exceptionStatusList" index="index" item="exceptionStatus" separator="," open="(" close=")">
  112. #{exceptionStatus}
  113. </foreach>
  114. </if>
  115. <choose>
  116. <when test="sort != null and sort !='' and sort=='priceDate' and order != null and order !=''">
  117. order by asset.price_date ${order}
  118. </when>
  119. <otherwise>
  120. order by asset.price_date desc
  121. </otherwise>
  122. </choose>
  123. limit #{offset},#{pageSize}
  124. </select>
  125. <select id="countAssetDetail" resultType="java.lang.Long"
  126. parameterType="com.simuwang.base.pojo.dto.query.ParseDetailPageQuery">
  127. select count(1) from (
  128. select distinct asset.id,
  129. asset.fund_id,
  130. asset.fund_name,
  131. info.fund_id as target_fund_id,
  132. info.fund_name as target_fund_name,
  133. asset.register_number,
  134. asset.price_date,
  135. asset.asset_net,
  136. asset.asset_share,
  137. asset.is_stored,
  138. asset.exception_status,
  139. asset.updatetime,
  140. parse.email_title,
  141. parse.id as email_id
  142. from email_fund_asset asset
  143. join email_file_info file
  144. on asset.file_id = file.id
  145. join email_parse_info parse
  146. on file.email_id = parse.id
  147. left join pvn_fund_info info
  148. on asset.fund_id=info.fund_id and info.isvalid=1
  149. where asset.isvalid=1 and file.isvalid=1 and parse.isvalid=1
  150. <if test="fundName != null and fundName !=''">
  151. and (asset.fund_name like concat('%',#{fundName},'%') or asset.register_number like concat('%',#{fundName},'%'))
  152. </if>
  153. <if test="priceStartDate != null and priceStartDate !=''">
  154. and asset.price_date >= #{priceStartDate}
  155. </if>
  156. <if test="priceEndDate != null and priceEndDate !=''">
  157. and asset.price_date <![CDATA[ <= ]]> #{priceEndDate}
  158. </if>
  159. <if test="updateStartDate != null and updateStartDate !=''">
  160. and asset.updatetime <![CDATA[ >= ]]> #{updateStartDate}
  161. </if>
  162. <if test="updateEndDate != null and updateEndDate !=''">
  163. and asset.updatetime <![CDATA[ <= ]]> #{updateEndDate}
  164. </if>
  165. <if test="isStore != null">
  166. and asset.is_stored = #{isStore}
  167. </if>
  168. <if test="emailTitle != null and emailTitle != ''">
  169. and parse.email_title like concat('%',#{emailTitle},'%')
  170. </if>
  171. <if test="emailId != null and emailId !=''">
  172. and parse.id =#{emailId}
  173. </if>
  174. <if test="exceptionStatusList != null">
  175. and asset.exception_status in
  176. <foreach collection="exceptionStatusList" index="index" item="exceptionStatus" separator="," open="(" close=")">
  177. #{exceptionStatus}
  178. </foreach>
  179. </if>
  180. )a
  181. </select>
  182. <select id="countNoStoreAsset" resultType="java.lang.Integer" parameterType="java.lang.String">
  183. select count(id)
  184. from email_fund_asset
  185. where isvalid =1 and exception_status=3
  186. <if test="fundName != null and fundName !=''">
  187. and fund_name=#{fundName}
  188. </if>
  189. <if test="registerNumber != null and registerNumber !=''">
  190. and register_number=#{registerNumber}
  191. </if>
  192. </select>
  193. <select id="selectNotMappingAsset" resultMap="BaseResultMap"
  194. parameterType="java.lang.String">
  195. select distinct id,fund_id,file_id, fund_name,register_number,price_date,asset_net,asset_share,is_stored,exception_status,
  196. updatetime
  197. from email_fund_asset
  198. where isvalid =1 and exception_status=3
  199. <if test="fundName != null and fundName !=''">
  200. and fund_name=#{fundName}
  201. </if>
  202. <if test="registerNumber != null and registerNumber !=''">
  203. and register_number=#{registerNumber}
  204. </if>
  205. </select>
  206. <resultMap id="BaseDetailMap" type="com.simuwang.base.pojo.dos.EmailParseDetailDO">
  207. <result column="fund_id" property="fundId"/>
  208. <result column="fund_name" property="fundName"/>
  209. <result column="register_number" property="registerNumber"/>
  210. <result column="price_date" property="priceDate"/>
  211. <result column="nav" property="nav"/>
  212. <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
  213. <result column="asset_net" property="assetNet"/>
  214. <result column="asset_share" property="assetShare"/>
  215. <result column="nav_is_stored" property="navIsStored"/>
  216. <result column="nav_exception_status" property="navExceptionStatus"/>
  217. <result column="asset_is_stored" property="assetIsStored"/>
  218. <result column="asset_exception_status" property="assetExceptionStatus"/>
  219. <result column="updatetime" property="updateTime"/>
  220. </resultMap>
  221. <select id="selectFundAssetByFielId" resultMap="BaseDetailMap">
  222. SELECT DISTINCT
  223. asset.fund_id,
  224. asset.fund_name,
  225. asset.register_number,
  226. asset.price_date,
  227. null as nav,
  228. null as cumulative_nav_withdrawal,
  229. asset.asset_net as asset_net,
  230. asset.asset_share as asset_share,
  231. null AS nav_is_stored,
  232. null AS nav_exception_status,
  233. asset.is_stored as asset_is_stored,
  234. asset.exception_status as asset_exception_status,
  235. asset.updatetime
  236. FROM
  237. EMAIL_FILE_INFO efi
  238. JOIN email_fund_asset asset
  239. ON efi.id = asset.file_id
  240. AND asset.isvalid = 1
  241. WHERE efi.isvalid = 1
  242. AND efi.id = #{fileId} and asset.price_date=#{priceDate}
  243. </select>
  244. <select id="selectAssetByFundId" resultMap="BaseResultMap">
  245. select id,file_id, fund_id, fund_name,register_number,price_date,asset_net,asset_share,is_stored,exception_status,
  246. isvalid, creatorid, createtime, updaterid, updatetime
  247. from email_fund_asset where isvalid=1 and fund_id=#{fundId}
  248. </select>
  249. <select id="countEmailAssetTotal" resultType="java.lang.Long">
  250. select count(1) from email_fund_asset where isvalid=1
  251. </select>
  252. <delete id="deleteByFileId">
  253. update email_fund_asset
  254. set isvalid = 0,
  255. updatetime= now()
  256. where isvalid = 1
  257. and file_id = #{fileId}
  258. </delete>
  259. </mapper>