FundInfoMapper.xml 12 KB

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