FundInfoMapper.xml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 * from (
  42. select f.fund_id as fundId,
  43. f.fund_short_name as fundShortName,
  44. c.company_short_name as companyShortName,
  45. f.inception_date as inceptionDate,
  46. ifnull(n.last_price_date,'') as lastPriceDate,
  47. r.nav_frequency as navFrequency,
  48. r.asset_Frequency as assetFrequency,
  49. r.frequency_remark as frequencyRemark
  50. from PPW_EMAIL.pvn_fund_info f
  51. join PPW_EMAIL.pvn_company_info c on f.trust_id = c.company_id
  52. 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
  53. on f.fund_id = n .fund_id
  54. left join PPW_EMAIL.fund_report_frequency r on r.fund_id = f.fund_id and r.isvalid =1
  55. where f.isvalid =1 and c.isvalid =1
  56. <if test="fundId != null and fundId !=''">
  57. and f.fund_id like concat('%',#{fundId},'%')
  58. </if>
  59. <if test="fundShortName != null and fundShortName !=''">
  60. and (f.fund_name like concat('%',#{fundShortName},'%') or f.fund_short_name like concat('%',#{fundShortName},'%') or f.register_number like concat('%',#{fundShortName},'%'))
  61. </if>
  62. <if test="companyShortName != null and companyShortName !=''">
  63. and (c.company_name like concat('%',#{companyShortName},'%') or c.company_short_name like concat('%',#{companyShortName},'%') or c.register_number like concat('%',#{companyShortName},'%'))
  64. </if>
  65. <if test="navFrequency != null and navFrequency !=''">
  66. and r.nav_frequency = #{navFrequency}
  67. </if>
  68. <if test="assetFrequency != null and assetFrequency !=''">
  69. and r.asset_Frequency = #{assetFrequency}
  70. </if>
  71. <if test="startDate != null and startDate !=''">
  72. and f.inception_date <![CDATA[ >= ]]> #{startDate}
  73. </if>
  74. <if test="endDate != null and endDate !=''">
  75. and f.inception_date <![CDATA[ <= ]]> #{endDate}
  76. </if>) a
  77. limit #{offset},#{pageSize}
  78. order by a.lastPriceDate desc
  79. </select>
  80. <select id="queryFundByNameAndRegisterNumber" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
  81. select fund_id as fundId,
  82. fund_name as fundName,
  83. register_number as registerNumber
  84. from PPW_EMAIL.pvn_fund_info
  85. where isvalid = 1
  86. and fund_name = #{fundName}
  87. and register_number = #{registerNumber}
  88. </select>
  89. <select id="queryFundByName" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
  90. select fund_id as fundId,
  91. fund_name as fundName,
  92. register_number as registerNumber
  93. from PPW_EMAIL.pvn_fund_info
  94. where isvalid = 1
  95. and fund_name = #{fundName} and register_number is null
  96. </select>
  97. <select id="queryFundByRegisterNumber" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
  98. select fund_id as fundId,
  99. fund_name as fundName,
  100. register_number as registerNumber
  101. from PPW_EMAIL.pvn_fund_info
  102. where isvalid = 1
  103. and register_number = #{registerNumber} and fund_name is null
  104. </select>
  105. <select id="countFundInfoByKeyword" resultType="java.lang.Long"
  106. parameterType="com.simuwang.base.pojo.dto.query.FundInputPageQuery">
  107. select count(f.fund_id)
  108. from PPW_EMAIL.pvn_fund_info f where f.isvalid =1
  109. <if test="keyword != null and keyword !=''">
  110. 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},'%'))
  111. </if>
  112. </select>
  113. <select id="countFundInfo" resultType="java.lang.Long"
  114. parameterType="com.simuwang.base.pojo.dto.query.FundInfoPageQuery">
  115. select count(f.fund_id)
  116. from PPW_EMAIL.pvn_fund_info f
  117. join PPW_EMAIL.pvn_company_info c on f.trust_id = c.company_id
  118. 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
  119. on f.fund_id = n .fund_id
  120. left join PPW_EMAIL.fund_report_frequency r on r.fund_id = f.fund_id and r.isvalid =1
  121. where f.isvalid =1 and c.isvalid =1
  122. <if test="fundId != null and fundId !=''">
  123. and f.fund_id like concat('%',#{fundId},'%')
  124. </if>
  125. <if test="fundShortName != null and fundShortName !=''">
  126. and (f.fund_name like concat('%',#{fundShortName},'%') or f.fund_short_name like concat('%',#{fundShortName},'%') or f.register_number like concat('%',#{fundShortName},'%'))
  127. </if>
  128. <if test="companyShortName != null and companyShortName !=''">
  129. and (c.company_name like concat('%',#{companyShortName},'%') or c.company_short_name like concat('%',#{companyShortName},'%') or c.register_number like concat('%',#{companyShortName},'%'))
  130. </if>
  131. <if test="navFrequency != null and navFrequency !=''">
  132. and r.nav_frequency = #{navFrequency}
  133. </if>
  134. <if test="assetFrequency != null and assetFrequency !=''">
  135. and r.asset_Frequency = #{assetFrequency}
  136. </if>
  137. <if test="startDate != null and startDate !=''">
  138. and f.inception_date <![CDATA[ >= ]]> #{startDate}
  139. </if>
  140. <if test="endDate != null and endDate !=''">
  141. and f.inception_date <![CDATA[ <= ]]> #{endDate}
  142. </if>
  143. </select>
  144. <select id="getFundNameByFundId" resultType="java.lang.String" parameterType="java.lang.String">
  145. select fund_name from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
  146. </select>
  147. <select id="queryFundIdByName" resultType="java.lang.String" parameterType="java.lang.String">
  148. select fund_id
  149. from PPW_EMAIL.pvn_fund_info
  150. where isvalid = 1
  151. and fund_name = #{fundName} limit 1
  152. </select>
  153. <select id="getCompanyNameByFundId" resultType="java.lang.String" parameterType="java.lang.String">
  154. select c.company_name from PPW_EMAIL.pvn_company_info c
  155. join PPW_EMAIL.pvn_fund_info info on info.trust_id=c.company_id
  156. where info.fund_id=#{fundId} and info.isvalid=1 and c.isvalid=1
  157. </select>
  158. <select id="getLiquidateDateByFundId" resultType="java.lang.String" parameterType="java.lang.String">
  159. select liquidate_date from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
  160. </select>
  161. <select id="getFundIdByCompanyId" resultType="java.lang.String" parameterType="java.lang.String">
  162. select info.fund_id from PPW_EMAIL.pvn_fund_info info join PPW_EMAIL.pvn_company_info c on info.trust_id=c.company_id
  163. where info.isvalid=1 and c.isvalid=1 and c.company_id=#{companyId}
  164. </select>
  165. <select id="getInceptionDateByFundId" resultType="java.lang.String" parameterType="java.lang.String">
  166. select inception_date from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
  167. </select>
  168. </mapper>