EmailFundAssetMapper.xml 11 KB

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