FundInfoMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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="trust_company_name" property="trustCompanyName"/>
  27. <result column="createtime" property="createTime"/>
  28. <result column="updatetime" property="updateTime"/>
  29. <result column="isvalid" property="isvalid"/>
  30. </resultMap>
  31. <select id="searchFundInfoByKeyword" resultType="java.util.Map">
  32. select f.fund_id as "fundId",
  33. f.fund_short_name as "fundShortName",
  34. f.register_number as "registerNumber"
  35. from PPW_EMAIL.pvn_fund_info f where f.isvalid =1
  36. <if test="keyword != null and keyword !=''">
  37. 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},'%'))
  38. </if>
  39. limit #{offset},#{pageSize}
  40. </select>
  41. <select id="searchFundInfoList" resultType="com.simuwang.base.pojo.dos.FundInformationDO">
  42. select * from (
  43. select f.fund_id as fundId,
  44. f.fund_short_name as fundShortName,
  45. f.register_number as registerNumber,
  46. c.company_id as companyId,
  47. c.company_short_name as companyShortName,
  48. c.company_name as companyName,
  49. c.credit_code as creditCode,
  50. f.inception_date as inceptionDate,
  51. ifnull(n.last_price_date,'') as lastPriceDate,
  52. r.nav_frequency as navFrequency,
  53. r.asset_Frequency as assetFrequency,
  54. r.valuation_Frequency as valuationFrequency,
  55. r.frequency_remark as frequencyRemark
  56. from PPW_EMAIL.pvn_fund_info f
  57. join PPW_EMAIL.pvn_company_info c on f.trust_id = c.company_id
  58. 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
  59. on f.fund_id = n .fund_id
  60. left join PPW_EMAIL.fund_report_frequency r on r.fund_id = f.fund_id and r.isvalid =1
  61. where f.isvalid =1 and c.isvalid =1
  62. <if test="fundId != null and fundId !=''">
  63. and f.fund_id like concat('%',#{fundId},'%')
  64. </if>
  65. <if test="fundShortName != null and fundShortName !=''">
  66. and (f.fund_name like concat('%',#{fundShortName},'%') or f.fund_short_name like concat('%',#{fundShortName},'%') or f.register_number like concat('%',#{fundShortName},'%'))
  67. </if>
  68. <if test="companyShortName != null and companyShortName !=''">
  69. and (c.company_name like concat('%',#{companyShortName},'%') or c.company_short_name like concat('%',#{companyShortName},'%') or c.register_number like concat('%',#{companyShortName},'%'))
  70. </if>
  71. <if test="navFrequency != null and navFrequency !=''">
  72. and r.nav_frequency = #{navFrequency}
  73. </if>
  74. <if test="assetFrequency != null and assetFrequency !=''">
  75. and r.asset_Frequency = #{assetFrequency}
  76. </if>
  77. <if test="valuationFrequency != null and valuationFrequency !=''">
  78. and r.valuation_Frequency = #{valuationFrequency}
  79. </if>
  80. <if test="startDate != null and startDate !=''">
  81. and f.inception_date <![CDATA[ >= ]]> #{startDate}
  82. </if>
  83. <if test="endDate != null and endDate !=''">
  84. and f.inception_date <![CDATA[ <= ]]> #{endDate}
  85. </if>) a
  86. limit #{offset},#{pageSize}
  87. order by a.lastPriceDate desc
  88. </select>
  89. <select id="queryFundByNameAndRegisterNumber" 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}
  96. and register_number = #{registerNumber}
  97. </select>
  98. <select id="queryFundByName" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
  99. select fund_id as fundId,
  100. fund_name as fundName,
  101. register_number as registerNumber
  102. from PPW_EMAIL.pvn_fund_info
  103. where isvalid = 1
  104. and fund_name = #{fundName}
  105. </select>
  106. <select id="queryFundByRegisterNumber" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
  107. select fund_id as fundId,
  108. fund_name as fundName,
  109. register_number as registerNumber
  110. from PPW_EMAIL.pvn_fund_info
  111. where isvalid = 1
  112. and register_number = #{registerNumber}
  113. </select>
  114. <select id="countFundInfoByKeyword" resultType="java.lang.Long"
  115. parameterType="com.simuwang.base.pojo.dto.query.FundInputPageQuery">
  116. select count(f.fund_id)
  117. from PPW_EMAIL.pvn_fund_info f where f.isvalid =1
  118. <if test="keyword != null and keyword !=''">
  119. 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},'%'))
  120. </if>
  121. </select>
  122. <select id="countFundInfo" resultType="java.lang.Long"
  123. parameterType="com.simuwang.base.pojo.dto.query.FundInfoPageQuery">
  124. select count(f.fund_id)
  125. from PPW_EMAIL.pvn_fund_info f
  126. join PPW_EMAIL.pvn_company_info c on f.trust_id = c.company_id
  127. 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
  128. on f.fund_id = n .fund_id
  129. left join PPW_EMAIL.fund_report_frequency r on r.fund_id = f.fund_id and r.isvalid =1
  130. where f.isvalid =1 and c.isvalid =1
  131. <if test="fundId != null and fundId !=''">
  132. and f.fund_id like concat('%',#{fundId},'%')
  133. </if>
  134. <if test="fundShortName != null and fundShortName !=''">
  135. and (f.fund_name like concat('%',#{fundShortName},'%') or f.fund_short_name like concat('%',#{fundShortName},'%') or f.register_number like concat('%',#{fundShortName},'%'))
  136. </if>
  137. <if test="companyShortName != null and companyShortName !=''">
  138. and (c.company_name like concat('%',#{companyShortName},'%') or c.company_short_name like concat('%',#{companyShortName},'%') or c.register_number like concat('%',#{companyShortName},'%'))
  139. </if>
  140. <if test="navFrequency != null and navFrequency !=''">
  141. and r.nav_frequency = #{navFrequency}
  142. </if>
  143. <if test="assetFrequency != null and assetFrequency !=''">
  144. and r.asset_Frequency = #{assetFrequency}
  145. </if>
  146. <if test="valuationFrequency != null and valuationFrequency !=''">
  147. and r.valuation_Frequency = #{valuationFrequency}
  148. </if>
  149. <if test="startDate != null and startDate !=''">
  150. and f.inception_date <![CDATA[ >= ]]> #{startDate}
  151. </if>
  152. <if test="endDate != null and endDate !=''">
  153. and f.inception_date <![CDATA[ <= ]]> #{endDate}
  154. </if>
  155. </select>
  156. <select id="getFundNameByFundId" resultType="java.lang.String" parameterType="java.lang.String">
  157. select fund_name from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
  158. </select>
  159. <select id="queryFundIdByName" resultType="java.lang.String" parameterType="java.lang.String">
  160. select fund_id
  161. from PPW_EMAIL.pvn_fund_info
  162. where isvalid = 1
  163. and fund_name = #{fundName} limit 1
  164. </select>
  165. <select id="getCompanyNameByFundId" resultType="java.lang.String" parameterType="java.lang.String">
  166. select c.company_name from PPW_EMAIL.pvn_company_info c
  167. join PPW_EMAIL.pvn_fund_info info on info.trust_id=c.company_id
  168. where info.fund_id=#{fundId} and info.isvalid=1 and c.isvalid=1
  169. </select>
  170. <select id="getLiquidateDateByFundId" resultType="java.lang.String" parameterType="java.lang.String">
  171. select liquidate_date from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
  172. </select>
  173. <select id="getFundIdByCompanyId" resultType="java.lang.String" parameterType="java.lang.String">
  174. 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
  175. where info.isvalid=1 and c.isvalid=1 and c.company_id=#{companyId}
  176. </select>
  177. <select id="getInceptionDateByFundId" resultType="java.lang.String" parameterType="java.lang.String">
  178. select inception_date from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
  179. </select>
  180. <select id="queryFundAndTrustByRegisterNumber" resultType="com.simuwang.base.pojo.dos.FundAndCompanyInfoDO">
  181. select t.fund_id as fundId,
  182. t.fund_name as fundName,
  183. t.register_number as registerNumber,
  184. t1.company_id as companyId,
  185. t1.company_name as companyName
  186. from PPW_EMAIL.pvn_fund_info t
  187. left join PPW_EMAIL.pvn_company_info t1 on t1.isvalid = 1 and t1.company_id = t.trust_id
  188. where t.isvalid = 1
  189. and t.register_number = #{registerNumber}
  190. limit 1
  191. </select>
  192. <select id="searchFundDetail" resultMap="BaseResultMap"
  193. parameterType="java.lang.String">
  194. select info.id,info.p_fund_id,info.fund_id,info.fund_name,
  195. info.fund_short_name,info.fund_type,info.manager_type,
  196. info.base_currency,info.inception_date,info.advisor_id,a.company_name as advisor_company_name,
  197. info.issuer_id,t.company_name as trust_company_name,info.custodian_id,info.trust_id,
  198. info.register_number,info.register_date,info.createtime,
  199. info.is_amac_show,info.fund_status,info.amac_source_type,
  200. info.investment_type,info.liquidate_date,info.performance_start_date,
  201. info.is_shareclass,info.amac_url
  202. from PPW_EMAIL.pvn_fund_info info
  203. left join PPW_EMAIL.pvn_company_info a
  204. on info.advisor_id = a.company_id and a.isvalid=1
  205. left join PPW_EMAIL.pvn_company_info t
  206. on info.trust_id = t.company_id and t.isvalid=1
  207. where info.isvalid=1 and info.fund_id=#{fundId}
  208. </select>
  209. </mapper>