FundInfoMapper.xml 10 KB

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