EmailFundAssetMapper.xml 11 KB

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