NavMapper.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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.NavMapper">
  4. <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.NavDO">
  5. <id column="id" property="id"/>
  6. <result column="fund_id" property="fundId"/>
  7. <result column="price_date" property="priceDate"/>
  8. <result column="nav" property="nav"/>
  9. <result column="cumulative_nav" property="cumulativeNav"/>
  10. <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
  11. <result column="isvalid" property="isvalid"/>
  12. <result column="creatorid" property="creatorId"/>
  13. <result column="createtime" property="createTime"/>
  14. <result column="updaterid" property="updaterId"/>
  15. <result column="updatetime" property="updateTime"/>
  16. </resultMap>
  17. <insert id="batchInsert" parameterType="com.simuwang.base.pojo.dos.NavDO">
  18. insert into PPW_EMAIL.nav(fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
  19. isvalid, creatorid, createtime, updaterid, updatetime)
  20. values
  21. <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
  22. (#{itemDo.fundId},#{itemDo.priceDate},#{itemDo.nav},#{itemDo.cumulativeNav},#{itemDo.cumulativeNavWithdrawal},
  23. #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
  24. </foreach>
  25. </insert>
  26. <insert id="batchUpdate">
  27. <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
  28. update PPW_EMAIL.nav
  29. <set>
  30. nav = #{itemDo.nav},
  31. cumulative_nav_withdrawal = #{itemDo.cumulativeNavWithdrawal},
  32. updatetime=#{itemDo.updateTime}
  33. </set>
  34. where isvalid = 1
  35. and fund_id = #{itemDo.fundId}
  36. and price_date = #{itemDo.priceDate}
  37. </foreach>
  38. </insert>
  39. <insert id="saveNav" parameterType="com.simuwang.base.pojo.dos.NavDO">
  40. insert into PPW_EMAIL.nav(fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
  41. isvalid, creatorid, createtime, updaterid, updatetime)
  42. values
  43. (#{fundId},#{priceDate},#{nav},#{cumulativeNav},#{cumulativeNavWithdrawal},
  44. #{isvalid}, #{creatorId}, #{createTime}, #{updaterId}, #{updateTime})
  45. </insert>
  46. <update id="updateNav" parameterType="com.simuwang.base.pojo.dos.NavDO">
  47. update PPW_EMAIL.nav
  48. <set>
  49. nav = #{nav},
  50. cumulative_nav_withdrawal = #{cumulativeNavWithdrawal},
  51. updatetime=#{updateTime}
  52. </set>
  53. where isvalid = 1
  54. and id=#{id}
  55. </update>
  56. <update id="batchDeleteNav">
  57. update PPW_EMAIL.nav set isvalid=0,updatetime=sysdate() where fund_id=#{fundId}
  58. and price_date in
  59. <foreach collection="priceDateList" index="index" item="priceDate" separator="," open="(" close=")">
  60. #{priceDate}
  61. </foreach>
  62. </update>
  63. <delete id="deleteNav">
  64. update PPW_EMAIL.nav set isvalid=0,updatetime=sysdate(),updaterid=#{updaterId} where fund_id=#{fundId} and price_date=#{priceDate}
  65. </delete>
  66. <select id="queryFundNavByDate" resultType="java.lang.String">
  67. select price_date
  68. from PPW_EMAIL.nav
  69. where isvalid = 1
  70. and fund_id = #{fundId}
  71. and price_date in
  72. <foreach collection="priceDateList" index="index" item="priceDate" separator="," open="(" close=")">
  73. #{priceDate}
  74. </foreach>
  75. </select>
  76. <select id="queryFundNav" resultMap="BaseResultMap"
  77. parameterType="com.simuwang.base.pojo.dos.NavDO">
  78. SELECT id, fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
  79. isvalid, creatorid, createtime, updaterid, updatetime
  80. from PPW_EMAIL.nav
  81. where isvalid = 1
  82. and fund_id = #{fundId}
  83. and price_date=#{priceDate}
  84. </select>
  85. <select id="getAllFundId" resultType="java.lang.String">
  86. select distinct fund_id from PPW_EMAIL.nav where isvalid=1
  87. </select>
  88. <select id="selectNavByFundId" resultMap="BaseResultMap"
  89. parameterType="java.lang.String">
  90. SELECT id, fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
  91. isvalid, creatorid, createtime, updaterid, updatetime
  92. from PPW_EMAIL.nav
  93. where isvalid = 1
  94. and fund_id = #{fundId}
  95. order by price_date
  96. </select>
  97. <select id="countNavTotal" resultType="java.lang.Long">
  98. select count(1) from PPW_EMAIL.nav where isvalid=1
  99. </select>
  100. <select id="countNavByTime" resultType="java.lang.Long">
  101. select count(1) from PPW_EMAIL.nav where updatetime <![CDATA[ <= ]]> #{endDate}
  102. <if test="startDate != null and startDate !=''">
  103. and updatetime >= #{startDate}
  104. </if>
  105. </select>
  106. <select id="selectNavListByTime" resultMap="BaseResultMap">
  107. select id,fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
  108. isvalid, creatorid, createtime, updaterid, updatetime
  109. from PPW_EMAIL.nav where updatetime <![CDATA[ <= ]]> #{endDate}
  110. <if test="startDate != null and startDate !=''">
  111. and updatetime >= #{startDate}
  112. </if>
  113. order by id
  114. </select>
  115. <select id="selectMaxMinId" resultType="java.util.Map">
  116. select max(id) as maxId,min(id) as minId from PPW_EMAIL.nav where updatetime <![CDATA[ <= ]]> #{endDate}
  117. <if test="startDate != null and startDate !=''">
  118. and updatetime >= #{startDate}
  119. </if>
  120. </select>
  121. <select id="selectNavListById" resultType="com.simuwang.base.pojo.dos.NavDO">
  122. select id,fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
  123. isvalid, creatorid, createtime, updaterid, updatetime
  124. from PPW_EMAIL.nav where updatetime <![CDATA[ <= ]]> #{endDate} and id >= #{minId} and id <![CDATA[ <= ]]> #{maxId}
  125. <if test="startDate != null and startDate !=''">
  126. and updatetime >= #{startDate}
  127. </if>
  128. order by id
  129. </select>
  130. </mapper>