EmailFundNavMapper.xml 12 KB

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