FundInfoMapper.xml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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.FundInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.FundInfoDO">
  5. <id column="id" property="id"/>
  6. <result column="p_fund_id" property="pFundId"/>
  7. <result column="fund_name" property="fundName"/>
  8. <result column="fund_short_name" property="fundShortName"/>
  9. <result column="fund_type" property="fundType"/>
  10. <result column="manager_type" property="managerType"/>
  11. <result column="base_currency" property="baseCurrency"/>
  12. <result column="inception_date" property="inceptionDate"/>
  13. <result column="advisor_id" property="advisorId"/>
  14. <result column="issuer_id" property="issuerId"/>
  15. <result column="custodian_id" property="custodianId"/>
  16. <result column="register_number" property="registerNumber"/>
  17. <result column="register_date" property="registerDate"/>
  18. <result column="is_amac_show" property="isAmacShow"/>
  19. <result column="fund_status" property="fundStatus"/>
  20. <result column="amac_source_type" property="amacSourceType"/>
  21. <result column="investment_type" property="investmentType"/>
  22. <result column="liquidate_date" property="liquidateDate"/>
  23. <result column="performance_start_date" property="performanceStartDate"/>
  24. <result column="is_shareclass" property="isShareclass"/>
  25. <result column="trust_id" property="trustId"/>
  26. <result column="createtime" property="createTime"/>
  27. <result column="updatetime" property="updateTime"/>
  28. <result column="isvalid" property="isvalid"/>
  29. </resultMap>
  30. <select id="searchFundInfoByKeyword" resultType="java.util.Map">
  31. select f.fund_id as "fundId",
  32. f.fund_short_name as "fundShortName",
  33. f.register_number as "registerNumber"
  34. from PPW_EMAIL.pvn_fund_info f where f.isvalid =1
  35. <if test="keyword != null and keyword !=''">
  36. and (f.fund_name like concat('%',#{keyword},'%') or f.fund_short_name like concat('%',#{keyword},'%') or f.register_number like concat('%',#{keyword},'%') or f.fund_id like concat('%',#{keyword},'%'))
  37. </if>
  38. limit #{offset},#{pageSize}
  39. </select>
  40. <select id="searchFundInfoList" resultType="com.simuwang.base.pojo.vo.FundInformationVO">
  41. select f.fund_id as fundId,
  42. f.fund_short_name as fundShortName,
  43. c.company_short_name as companyShortName,
  44. f.inception_date as inceptionDate,
  45. n.last_price_date as lastPriceDate,
  46. r.nav_frequency as navFrequency,
  47. r.asset_Frequency as assetFrequency,
  48. r.frequency_remark as frequencyRemark
  49. from PPW_EMAIL.pvn_fund_info f
  50. join PPW_EMAIL.pvn_company_info c on f.trust_id = c.company_id
  51. left join (select nv.fund_id,max(nv.price_date) as last_price_date from PPW_EMAIL.nav nv where nv.isvalid =1 group by nv.fund_id) n
  52. on f.fund_id = n .fund_id
  53. left join PPW_EMAIL.fund_report_frequency r on r.fund_id = f.fund_id and r.isvalid =1
  54. where f.isvalid =1 and c.isvalid =1
  55. <if test="fundId != null and fundId !=''">
  56. and f.fund_id like concat('%',#{fundId},'%')
  57. </if>
  58. <if test="fundShortName != null and fundShortName !=''">
  59. and (f.fund_name like concat('%',#{fundShortName},'%') or f.fund_short_name like concat('%',#{fundShortName},'%') or f.register_number like concat('%',#{fundShortName},'%'))
  60. </if>
  61. <if test="companyShortName != null and companyShortName !=''">
  62. and (c.company_name like concat('%',#{companyShortName},'%') or c.company_short_name like concat('%',#{companyShortName},'%') or c.register_number like concat('%',#{companyShortName},'%'))
  63. </if>
  64. <if test="navFrequency != null and navFrequency !=''">
  65. and r.nav_frequency = #{navFrequency}
  66. </if>
  67. <if test="assetFrequency != null and assetFrequency !=''">
  68. and r.asset_Frequency = #{assetFrequency}
  69. </if>
  70. <if test="startDate != null and startDate !=''">
  71. and f.inception_date <![CDATA[ >= ]]> #{startDate}
  72. </if>
  73. <if test="endDate != null and endDate !=''">
  74. and f.inception_date <![CDATA[ <= ]]> #{endDate}
  75. </if>
  76. order by n.last_price_date desc
  77. limit #{offset},#{pageSize}
  78. </select>
  79. <select id="queryFundByNameAndRegisterNumber" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
  80. select fund_id as fundId,
  81. fund_name as fundName,
  82. register_number as registerNumber
  83. from PPW_EMAIL.pvn_fund_info
  84. where isvalid = 1
  85. and fund_name = #{fundName}
  86. and register_number = #{registerNumber}
  87. </select>
  88. <select id="queryFundByName" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
  89. select fund_id as fundId,
  90. fund_name as fundName,
  91. register_number as registerNumber
  92. from PPW_EMAIL.pvn_fund_info
  93. where isvalid = 1
  94. and fund_name = #{fundName} and register_number is null
  95. </select>
  96. <select id="queryFundByRegisterNumber" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
  97. select fund_id as fundId,
  98. fund_name as fundName,
  99. register_number as registerNumber
  100. from PPW_EMAIL.pvn_fund_info
  101. where isvalid = 1
  102. and register_number = #{registerNumber} and fund_name is null
  103. </select>
  104. <select id="countFundInfoByKeyword" resultType="java.lang.Long"
  105. parameterType="com.simuwang.base.pojo.dto.query.FundInputPageQuery">
  106. select count(f.fund_id)
  107. from PPW_EMAIL.pvn_fund_info f where f.isvalid =1
  108. <if test="keyword != null and keyword !=''">
  109. and (f.fund_name like concat('%',#{keyword},'%') or f.fund_short_name like concat('%',#{keyword},'%') or f.register_number like concat('%',#{keyword},'%') or f.fund_id like concat('%',#{keyword},'%'))
  110. </if>
  111. </select>
  112. <select id="countFundInfo" resultType="java.lang.Long"
  113. parameterType="com.simuwang.base.pojo.dto.query.FundInfoPageQuery">
  114. select count(f.fund_id)
  115. from PPW_EMAIL.pvn_fund_info f
  116. join PPW_EMAIL.pvn_company_info c on f.trust_id = c.company_id
  117. left join (select nv.fund_id,max(nv.price_date) as last_price_date from PPW_EMAIL.nav nv where nv.isvalid =1 group by nv.fund_id) n
  118. on f.fund_id = n .fund_id
  119. left join PPW_EMAIL.fund_report_frequency r on r.fund_id = f.fund_id and r.isvalid =1
  120. where f.isvalid =1 and c.isvalid =1
  121. <if test="fundId != null and fundId !=''">
  122. and f.fund_id like concat('%',#{fundId},'%')
  123. </if>
  124. <if test="fundShortName != null and fundShortName !=''">
  125. and (f.fund_name like concat('%',#{fundShortName},'%') or f.fund_short_name like concat('%',#{fundShortName},'%') or f.register_number like concat('%',#{fundShortName},'%'))
  126. </if>
  127. <if test="companyShortName != null and companyShortName !=''">
  128. and (c.company_name like concat('%',#{companyShortName},'%') or c.company_short_name like concat('%',#{companyShortName},'%') or c.register_number like concat('%',#{companyShortName},'%'))
  129. </if>
  130. <if test="navFrequency != null and navFrequency !=''">
  131. and r.nav_frequency = #{navFrequency}
  132. </if>
  133. <if test="assetFrequency != null and assetFrequency !=''">
  134. and r.asset_Frequency = #{assetFrequency}
  135. </if>
  136. <if test="startDate != null and startDate !=''">
  137. and f.inception_date <![CDATA[ >= ]]> #{startDate}
  138. </if>
  139. <if test="endDate != null and endDate !=''">
  140. and f.inception_date <![CDATA[ <= ]]> #{endDate}
  141. </if>
  142. </select>
  143. <select id="getFundNameByFundId" resultType="java.lang.String" parameterType="java.lang.String">
  144. select fund_name from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
  145. </select>
  146. <select id="queryFundIdByName" resultType="java.lang.String" parameterType="java.lang.String">
  147. select fund_id
  148. from PPW_EMAIL.pvn_fund_info
  149. where isvalid = 1
  150. and fund_name = #{fundName} limit 1
  151. </select>
  152. <select id="getCompanyNameByFundId" resultType="java.lang.String" parameterType="java.lang.String">
  153. select c.company_name from PPW_EMAIL.pvn_company_info c
  154. join PPW_EMAIL.pvn_fund_info info on info.trust_id=c.company_id
  155. where info.fund_id=#{fundId} and info.isvalid=1 and c.isvalid=1
  156. </select>
  157. <select id="getInceptionDateByFundId" resultType="java.lang.String" parameterType="java.lang.String">
  158. select inception_date from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
  159. </select>
  160. </mapper>