EmailFundNavMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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.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 distinct nav.id,nav.file_id,
  54. nav.fund_id,
  55. nav.fund_name,
  56. info.fund_id as target_fund_id,
  57. info.fund_name as target_fund_name,
  58. nav.register_number,
  59. nav.price_date,
  60. nav.nav,
  61. nav.cumulative_nav_withdrawal,
  62. nav.exception_status,
  63. nav.is_stored,
  64. nav.updatetime,
  65. parse.email_title,
  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},'%')
  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="emailTitle != null and emailTitle != ''">
  101. and parse.email_title like concat('%',#{emailTitle},'%')
  102. </if>
  103. <if test="emailId != null and emailId !=''">
  104. and parse.id =#{emailId}
  105. </if>
  106. order by nav.updatetime desc
  107. limit #{offset},#{pageSize}
  108. </select>
  109. <select id="countNavDetail" resultType="java.lang.Long"
  110. parameterType="com.simuwang.base.pojo.dto.query.ParseDetailPageQuery">
  111. select count(1) from (
  112. SELECT distinct nav.id,nav.file_id,
  113. nav.fund_id,
  114. nav.fund_name,
  115. info.fund_id as target_fund_id,
  116. info.fund_name as target_fund_name,
  117. nav.register_number,
  118. nav.price_date,
  119. nav.nav,
  120. nav.cumulative_nav_withdrawal,
  121. nav.exception_status,
  122. nav.is_stored,
  123. nav.updatetime
  124. FROM
  125. PPW_EMAIL.email_fund_nav nav
  126. join PPW_EMAIL.email_file_info file
  127. on nav.file_id = file.id
  128. join PPW_EMAIL.email_parse_info parse
  129. on file.email_id = parse.id
  130. left join PPW_EMAIL.pvn_fund_info info
  131. on nav.fund_id=info.fund_id and info.isvalid=1
  132. WHERE nav.isvalid = 1 and file.isvalid=1 and parse.isvalid=1
  133. <if test="fundName != null and fundName !=''">
  134. and nav.fund_name like concat('%',#{fundName},'%')
  135. </if>
  136. <if test="priceStartDate != null and priceStartDate !=''">
  137. and nav.price_date >= #{priceStartDate}
  138. </if>
  139. <if test="priceEndDate != null and priceEndDate !=''">
  140. and nav.price_date <![CDATA[ <= ]]> #{priceEndDate}
  141. </if>
  142. <if test="exceptionStatusList != null">
  143. and nav.exception_status in
  144. <foreach collection="exceptionStatusList" index="index" item="exceptionStatus" separator="," open="(" close=")">
  145. #{exceptionStatus}
  146. </foreach>
  147. </if>
  148. <if test="updateStartDate != null and updateStartDate !=''">
  149. and nav.updatetime <![CDATA[ >= ]]> #{updateStartDate}
  150. </if>
  151. <if test="updateEndDate != null and updateEndDate !=''">
  152. and nav.updatetime <![CDATA[ <= ]]> #{updateEndDate}
  153. </if>
  154. <if test="isStore != null">
  155. and nav.is_stored = #{isStore}
  156. </if>
  157. <if test="emailTitle != null and emailTitle != ''">
  158. and parse.email_title like concat('%',#{emailTitle},'%')
  159. </if>
  160. <if test="emailId != null and emailId != ''">
  161. and parse.id=#{emailId}
  162. </if>
  163. ) a
  164. </select>
  165. <select id="countNoStoreNav" resultType="java.lang.Integer" parameterType="java.lang.String">
  166. select count(nav.id)
  167. from PPW_EMAIL.email_fund_nav nav
  168. where nav.isvalid =1 and nav.exception_status=3
  169. <if test="fundName != null and fundName != ''">
  170. and nav.fund_name=#{fundName}
  171. </if>
  172. <if test="registerNumber != null and registerNumber != ''">
  173. and nav.register_number=#{registerNumber}
  174. </if>
  175. </select>
  176. <select id="selectFileIdByFundName" resultType="java.lang.Integer" parameterType="java.lang.String">
  177. select distinct nav.file_id from PPW_EMAIL.email_fund_nav nav where nav.isvalid =1 and nav.exception_status in(1,3)
  178. <if test="fundName != null and fundName != ''">
  179. and nav.fund_name=#{fundName}
  180. </if>
  181. <if test="registerNumber != null and registerNumber != ''">
  182. and nav.register_number=#{registerNumber}
  183. </if>
  184. </select>
  185. <select id="selectNotMappingNav" resultMap="BaseResultMap"
  186. parameterType="java.lang.String">
  187. select nav.id,
  188. nav.file_id,
  189. nav.fund_id,
  190. nav.fund_name,
  191. nav.register_number,
  192. nav.price_date,
  193. nav.nav,
  194. nav.cumulative_nav_withdrawal,
  195. nav.exception_status,
  196. nav.is_stored,
  197. nav.isvalid,
  198. nav.creatorid,
  199. nav.updaterid,
  200. nav.updatetime,
  201. nav.createtime
  202. from PPW_EMAIL.email_fund_nav nav
  203. where nav.isvalid =1 and nav.exception_status in (1,3)
  204. <if test="fundName != null and fundName != ''">
  205. and nav.fund_name=#{fundName}
  206. </if>
  207. <if test="registerNumber != null and registerNumber != ''">
  208. and nav.register_number=#{registerNumber}
  209. </if>
  210. order by nav.updatetime desc
  211. </select>
  212. <select id="getMaxPriceDate" resultType="java.lang.String" parameterType="java.lang.String">
  213. select max(nav.price_date) from PPW_EMAIL.email_fund_nav nav where nav.isvalid =1 and nav.exception_status in (1,3)
  214. and nav.fund_name=#{fundName}
  215. </select>
  216. <resultMap id="BaseDetailMap" type="com.simuwang.base.pojo.dos.EmailParseDetailDO">
  217. <result column="fund_id" property="fundId"/>
  218. <result column="fund_name" property="fundName"/>
  219. <result column="register_number" property="registerNumber"/>
  220. <result column="price_date" property="priceDate"/>
  221. <result column="nav" property="nav"/>
  222. <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
  223. <result column="asset_net" property="assetNet"/>
  224. <result column="asset_share" property="assetShare"/>
  225. <result column="nav_is_stored" property="navIsStored"/>
  226. <result column="nav_exception_status" property="navExceptionStatus"/>
  227. <result column="asset_is_stored" property="assetIsStored"/>
  228. <result column="asset_exception_status" property="assetExceptionStatus"/>
  229. <result column="updatetime" property="updateTime"/>
  230. </resultMap>
  231. <select id="selectFundNavByFielId" resultMap="BaseDetailMap">
  232. SELECT DISTINCT
  233. nav.fund_id,
  234. nav.fund_name,
  235. nav.register_number,
  236. nav.price_date,
  237. nav.nav,
  238. nav.cumulative_nav_withdrawal,
  239. null as asset_net,
  240. null as asset_share,
  241. nav.is_stored AS nav_is_stored,
  242. nav.exception_status AS nav_exception_status,
  243. null as asset_is_stored,
  244. null as asset_exception_status,
  245. nav.updatetime
  246. FROM
  247. PPW_EMAIL.EMAIL_FILE_INFO efi
  248. JOIN PPW_EMAIL.email_fund_nav nav
  249. ON efi.id = nav.file_id
  250. AND nav.isvalid = 1
  251. WHERE efi.isvalid = 1
  252. AND efi.id = #{fileId} and nav.price_date=#{priceDate}
  253. </select>
  254. <select id="selectNavByFundId" resultMap="BaseResultMap">
  255. select nav.id,
  256. nav.file_id,
  257. nav.fund_id,
  258. nav.fund_name,
  259. nav.register_number,
  260. nav.price_date,
  261. nav.nav,
  262. nav.cumulative_nav_withdrawal,
  263. nav.exception_status,
  264. nav.is_stored,
  265. nav.isvalid,
  266. nav.creatorid,
  267. nav.updaterid,
  268. nav.updatetime,
  269. nav.createtime
  270. from PPW_EMAIL.email_fund_nav nav
  271. where nav.isvalid =1 and nav.exception_status=1
  272. and nav.fund_id = #{fundId}
  273. </select>
  274. <select id="countEmailNavTotal" resultType="java.lang.Long">
  275. select count(1) from PPW_EMAIL.email_fund_nav where isvalid=1
  276. </select>
  277. </mapper>