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 PPW_EMAIL.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. 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 PPW_EMAIL.pvn_fund_info f
  60. left join PPW_EMAIL.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 PPW_EMAIL.nav nv where nv.isvalid =1 group by nv.fund_id) n
  62. on f.fund_id = n .fund_id
  63. left join PPW_EMAIL.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. <choose>
  90. <when test="sort != null and sort !='' and sort=='lastPriceDate' and order != null and order !=''">
  91. order by
  92. CASE
  93. WHEN a.lastPriceDate IS NULL THEN 1
  94. ELSE 0
  95. END,
  96. a.lastPriceDate ${order}
  97. </when>
  98. <otherwise>
  99. order by a.lastPriceDate desc
  100. </otherwise>
  101. </choose>
  102. limit #{offset},#{pageSize}
  103. </select>
  104. <select id="queryFundByNameAndRegisterNumber" 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 fund_name = #{fundName}
  111. and register_number = #{registerNumber}
  112. </select>
  113. <select id="queryFundByName" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
  114. select fund_id as fundId,
  115. fund_name as fundName,
  116. register_number as registerNumber
  117. from PPW_EMAIL.pvn_fund_info
  118. where isvalid = 1
  119. and fund_name = #{fundName}
  120. </select>
  121. <select id="queryFundByRegisterNumber" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
  122. select fund_id as fundId,
  123. fund_name as fundName,
  124. register_number as registerNumber
  125. from PPW_EMAIL.pvn_fund_info
  126. where isvalid = 1
  127. and register_number = #{registerNumber}
  128. </select>
  129. <select id="countFundInfoByKeyword" resultType="java.lang.Long"
  130. parameterType="com.simuwang.base.pojo.dto.query.FundInputPageQuery">
  131. select count(f.fund_id)
  132. from PPW_EMAIL.pvn_fund_info f where f.isvalid =1
  133. <if test="keyword != null and keyword !=''">
  134. 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},'%'))
  135. </if>
  136. </select>
  137. <select id="countFundInfo" resultType="java.lang.Long"
  138. parameterType="com.simuwang.base.pojo.dto.query.FundInfoPageQuery">
  139. select count(f.fund_id)
  140. from PPW_EMAIL.pvn_fund_info f
  141. left join PPW_EMAIL.pvn_company_info c on f.trust_id = c.company_id and c.isvalid =1
  142. 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
  143. on f.fund_id = n .fund_id
  144. left join PPW_EMAIL.fund_report_frequency r on r.fund_id = f.fund_id and r.isvalid =1
  145. where f.isvalid =1
  146. <if test="fundId != null and fundId !=''">
  147. and f.fund_id like concat('%',#{fundId},'%')
  148. </if>
  149. <if test="fundShortName != null and fundShortName !=''">
  150. and (f.fund_name like concat('%',#{fundShortName},'%') or f.fund_short_name like concat('%',#{fundShortName},'%') or f.register_number like concat('%',#{fundShortName},'%'))
  151. </if>
  152. <if test="companyShortName != null and companyShortName !=''">
  153. and (c.company_name like concat('%',#{companyShortName},'%') or c.company_short_name like concat('%',#{companyShortName},'%') or c.register_number like concat('%',#{companyShortName},'%'))
  154. </if>
  155. <if test="navFrequency != null and navFrequency !=''">
  156. and r.nav_frequency = #{navFrequency}
  157. </if>
  158. <if test="assetFrequency != null and assetFrequency !=''">
  159. and r.asset_Frequency = #{assetFrequency}
  160. </if>
  161. <if test="valuationFrequency != null and valuationFrequency !=''">
  162. and r.valuation_Frequency = #{valuationFrequency}
  163. </if>
  164. <if test="startDate != null and startDate !=''">
  165. and f.inception_date <![CDATA[ >= ]]> #{startDate}
  166. </if>
  167. <if test="endDate != null and endDate !=''">
  168. and f.inception_date <![CDATA[ <= ]]> #{endDate}
  169. </if>
  170. </select>
  171. <select id="getFundNameByFundId" resultType="java.lang.String" parameterType="java.lang.String">
  172. select fund_name from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
  173. </select>
  174. <select id="queryFundIdByName" resultType="java.lang.String" parameterType="java.lang.String">
  175. select fund_id
  176. from PPW_EMAIL.pvn_fund_info
  177. where isvalid = 1
  178. and fund_name = #{fundName} limit 1
  179. </select>
  180. <select id="getCompanyNameByFundId" resultType="java.lang.String" parameterType="java.lang.String">
  181. select c.company_name from PPW_EMAIL.pvn_company_info c
  182. join PPW_EMAIL.pvn_fund_info info on info.trust_id=c.company_id
  183. where info.fund_id=#{fundId} and info.isvalid=1 and c.isvalid=1
  184. </select>
  185. <select id="getLiquidateDateByFundId" resultType="java.lang.String" parameterType="java.lang.String">
  186. select liquidate_date from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
  187. </select>
  188. <select id="getFundIdByCompanyId" resultType="java.lang.String" parameterType="java.lang.String">
  189. 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
  190. where info.isvalid=1 and c.isvalid=1 and c.company_id=#{companyId}
  191. </select>
  192. <select id="getInceptionDateByFundId" resultType="java.lang.String" parameterType="java.lang.String">
  193. select inception_date from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
  194. </select>
  195. <select id="queryFundAndTrustByRegisterNumber" resultType="com.simuwang.base.pojo.dos.FundAndCompanyInfoDO">
  196. select t.fund_id as fundId,
  197. t.fund_name as fundName,
  198. t.register_number as registerNumber,
  199. t1.company_id as companyId,
  200. t1.company_name as companyName
  201. from PPW_EMAIL.pvn_fund_info t
  202. left join PPW_EMAIL.pvn_company_info t1 on t1.isvalid = 1 and t1.company_id = t.trust_id
  203. where t.isvalid = 1
  204. and t.register_number = #{registerNumber}
  205. limit 1
  206. </select>
  207. <select id="searchFundDetail" resultMap="BaseResultMap"
  208. parameterType="java.lang.String">
  209. select info.id,info.p_fund_id,info.fund_id,info.fund_name,
  210. info.fund_short_name,info.fund_type,info.manager_type,
  211. info.base_currency,info.inception_date,info.advisor_id,a.company_name as advisor_company_name,
  212. info.issuer_id,ic.company_name as issuer_company_name,t.company_name as trust_company_name,info.custodian_id,info.trust_id,
  213. info.register_number,info.register_date,info.createtime,
  214. info.is_amac_show,info.fund_status,info.amac_source_type,
  215. info.investment_type,info.liquidate_date,info.performance_start_date,
  216. info.is_shareclass,info.amac_url
  217. from PPW_EMAIL.pvn_fund_info info
  218. left join PPW_EMAIL.pvn_company_info a
  219. on info.advisor_id = a.company_id and a.isvalid=1
  220. left join PPW_EMAIL.pvn_company_info t
  221. on info.trust_id = t.company_id and t.isvalid=1
  222. left join PPW_EMAIL.pvn_company_info ic
  223. on info.issuer_id = ic.company_id and ic.isvalid=1
  224. where info.isvalid=1 and info.fund_id=#{fundId}
  225. </select>
  226. <select id="countFundTotal" resultType="java.lang.Long">
  227. select count(1) from PPW_EMAIL.pvn_fund_info where isvalid=1
  228. </select>
  229. </mapper>