NavMapper.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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.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. <delete id="deleteNav">
  57. update PPW_EMAIL.nav set isvalid =0,updatetime=sysdate(),updaterid=#{updaterId} where fund_id=#{fundId} and price_date=#{priceDate} and isvalid =1
  58. </delete>
  59. <select id="queryFundNavByDate" resultType="java.lang.String">
  60. select price_date
  61. from PPW_EMAIL.nav
  62. where isvalid = 1
  63. and fund_id = #{fundId}
  64. and price_date in
  65. <foreach collection="priceDateList" index="index" item="priceDate" separator="," open="(" close=")">
  66. #{priceDate}
  67. </foreach>
  68. </select>
  69. <select id="queryFundNav" resultMap="BaseResultMap"
  70. parameterType="com.simuwang.base.pojo.dos.NavDO">
  71. SELECT id, fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
  72. isvalid, creatorid, createtime, updaterid, updatetime
  73. from PPW_EMAIL.nav
  74. where isvalid = 1
  75. and fund_id = #{fundId}
  76. and price_date=#{priceDate}
  77. </select>
  78. <select id="getAllFundId" resultType="java.lang.String">
  79. select distinct fund_id from PPW_EMAIL.nav where isvalid=1
  80. </select>
  81. <select id="selectNavByFundId" resultMap="BaseResultMap"
  82. parameterType="java.lang.String">
  83. SELECT id, fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
  84. isvalid, creatorid, createtime, updaterid, updatetime
  85. from PPW_EMAIL.nav
  86. where isvalid = 1
  87. and fund_id = #{fundId}
  88. order by price_date
  89. </select>
  90. </mapper>