FundNavAssetMapper.xml 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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.FundNavAssetMapper">
  4. <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.FundNavAssetDO">
  5. <result column="fund_id" property="fundId"/>
  6. <result column="fund_short_name" property="fundName"/>
  7. <result column="price_date" property="priceDate"/>
  8. <result column="nav" property="nav"/>
  9. <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
  10. <result column="asset_share" property="assetShare"/>
  11. <result column="asset_net" property="assetNet"/>
  12. <result column="updatetime" property="updateTime"/>
  13. </resultMap>
  14. <select id="searchNavAssetList" resultMap="BaseResultMap"
  15. parameterType="com.simuwang.base.pojo.dto.query.FundNavAssetPageQuery">
  16. SELECT distinct
  17. info.fund_id,
  18. info.fund_short_name,
  19. IFNULL(
  20. nav.price_date,
  21. asset.price_date
  22. ) AS price_date,
  23. nav.nav,
  24. nav.cumulative_nav_withdrawal,
  25. asset.asset_share,
  26. asset.asset_net,
  27. CASE
  28. WHEN nav.updatetime is null
  29. THEN asset.updatetime
  30. WHEN asset.updatetime is null
  31. THEN nav.updatetime
  32. WHEN asset.updatetime >= nav.updatetime
  33. THEN asset.updatetime
  34. ELSE nav.updatetime
  35. END AS updatetime
  36. FROM
  37. PPW_EMAIL.pvn_fund_info info
  38. LEFT JOIN PPW_EMAIL.nav nav
  39. ON info.fund_id = nav.fund_id
  40. AND nav.isvalid = 1
  41. LEFT JOIN PPW_EMAIL.asset asset
  42. ON info.fund_id = asset.fund_id
  43. AND nav.price_date = asset.price_date
  44. AND asset.isvalid = 1
  45. WHERE info.isvalid = 1
  46. and (nav.nav is not null or asset.asset_share is not null or asset.asset_net is not null)
  47. <if test="fundName != null and fundName !=''">
  48. and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%') or info.register_number like concat('%',#{fundName},'%'))
  49. </if>
  50. <if test="priceStartDate != null and priceStartDate !=''">
  51. and (nav.price_date >= #{priceStartDate} or asset.price_date >= #{priceStartDate})
  52. </if>
  53. <if test="priceEndDate != null and priceEndDate !=''">
  54. and (nav.price_date <![CDATA[ <= ]]> #{priceEndDate} or asset.price_date <![CDATA[ <= ]]> #{priceEndDate})
  55. </if>
  56. <if test="updateStartDate != null and updateStartDate !=''">
  57. and (nav.updatetime >= #{updateStartDate} or asset.updatetime >= #{updateStartDate})
  58. </if>
  59. <if test="updateEndDate != null and updateEndDate !=''">
  60. and (nav.updatetime <![CDATA[ <= ]]> #{updateEndDate} or asset.updatetime <![CDATA[ <= ]]> #{updateEndDate})
  61. </if>
  62. order by updatetime desc
  63. limit #{offset},#{pageSize}
  64. </select>
  65. <select id="countNavAssetList" resultType="java.lang.Long"
  66. parameterType="com.simuwang.base.pojo.dto.query.FundNavAssetPageQuery">
  67. SELECT count(1)
  68. FROM
  69. PPW_EMAIL.pvn_fund_info info
  70. LEFT JOIN PPW_EMAIL.nav nav
  71. ON info.fund_id = nav.fund_id
  72. AND nav.isvalid = 1
  73. LEFT JOIN PPW_EMAIL.asset asset
  74. ON info.fund_id = asset.fund_id
  75. AND nav.price_date = asset.price_date
  76. AND asset.isvalid = 1
  77. WHERE info.isvalid = 1
  78. and (nav.nav is not null or asset.asset_share is not null or asset.asset_net is not null)
  79. <if test="fundName != null and fundName !=''">
  80. and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%') or info.register_number like concat('%',#{fundName},'%'))
  81. </if>
  82. <if test="priceStartDate != null and priceStartDate !=''">
  83. and (nav.price_date >= #{priceStartDate} or asset.price_date >= #{priceStartDate})
  84. </if>
  85. <if test="priceEndDate != null and priceEndDate !=''">
  86. and (nav.price_date <![CDATA[ <= ]]> #{priceEndDate} or asset.price_date <![CDATA[ <= ]]> #{priceEndDate})
  87. </if>
  88. <if test="updateStartDate != null and updateStartDate !=''">
  89. and (nav.updatetime >= #{updateStartDate} or asset.updatetime >= #{updateStartDate})
  90. </if>
  91. <if test="updateEndDate != null and updateEndDate !=''">
  92. and (nav.updatetime <![CDATA[ <= ]]> #{updateEndDate} or asset.updatetime <![CDATA[ <= ]]> #{updateEndDate})
  93. </if>
  94. </select>
  95. </mapper>