AssetMapper.xml 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.AssetMapper">
  4. <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.AssetDO">
  5. <id column="id" property="id"/>
  6. <result column="fund_id" property="fundId"/>
  7. <result column="price_date" property="priceDate"/>
  8. <result column="asset_net" property="assetNet"/>
  9. <result column="asset_share" property="assetShare"/>
  10. <result column="isvalid" property="isvalid"/>
  11. <result column="creatorid" property="creatorId"/>
  12. <result column="createtime" property="createTime"/>
  13. <result column="updaterid" property="updaterId"/>
  14. <result column="updatetime" property="updateTime"/>
  15. </resultMap>
  16. <insert id="batchInsert" parameterType="com.simuwang.base.pojo.dos.AssetDO">
  17. insert into asset(fund_id,price_date,asset_net,asset_share,
  18. isvalid, creatorid, createtime, updaterid, updatetime,channel_id)
  19. values
  20. <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
  21. (#{itemDo.fundId},#{itemDo.priceDate},#{itemDo.assetNet},#{itemDo.assetShare},
  22. #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime}, #{itemDo.channelId})
  23. </foreach>
  24. </insert>
  25. <insert id="batchUpdate">
  26. <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
  27. update asset
  28. <set>
  29. asset_net = #{itemDo.assetNet},
  30. asset_share = #{itemDo.assetShare},
  31. updatetime=#{itemDo.updateTime}
  32. </set>
  33. where isvalid = 1
  34. and fund_id = #{itemDo.fundId}
  35. and price_date = #{itemDo.priceDate}
  36. and channel_id = #{itemDo.channelId}
  37. </foreach>
  38. </insert>
  39. <delete id="deleteAsset">
  40. update asset set isvalid=0,updatetime=now(),updaterid=#{updaterId} where fund_id=#{fundId} and price_date=#{priceDate}
  41. </delete>
  42. <delete id="batchDeleteAsset">
  43. update asset set isvalid=0,updatetime=now() where fund_id=#{fundId}
  44. and price_date in
  45. <foreach collection="priceDateList" index="index" item="priceDate" separator="," open="(" close=")">
  46. #{priceDate}
  47. </foreach>
  48. </delete>
  49. <select id="queryFundNavByDate" resultType="java.lang.String">
  50. select price_date
  51. from asset
  52. where isvalid = 1
  53. and fund_id = #{fundId}
  54. <if test="channelId != null and channelId !=''">
  55. and channel_id=#{channelId}
  56. </if>
  57. and price_date in
  58. <foreach collection="priceDateList" index="index" item="priceDate" separator="," open="(" close=")">
  59. #{priceDate}
  60. </foreach>
  61. </select>
  62. <select id="queryFundAsset" resultMap="BaseResultMap"
  63. parameterType="com.simuwang.base.pojo.dos.AssetDO">
  64. select id,fund_id,price_date,asset_net,asset_share,
  65. isvalid, creatorid, createtime, updaterid, updatetime
  66. from asset where isvalid=1 and fund_id=#{fundId} and price_date=#{priceDate}
  67. <if test="channelId != null and channelId !=''">
  68. and channel_id = #{channelId}
  69. </if>
  70. </select>
  71. <select id="selectAssetByFundId" resultMap="BaseResultMap">
  72. select id,fund_id,price_date,asset_net,asset_share,
  73. isvalid, creatorid, createtime, updaterid, updatetime,channel_id
  74. from asset where isvalid=1 and fund_id=#{fundId} and channel_id = #{channelId}
  75. </select>
  76. <select id="countAssetTotal" resultType="java.lang.Long">
  77. select count(1) from asset where isvalid=1
  78. </select>
  79. </mapper>