FundInformationDoMapper.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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.smppw.analysis.domain.mapper.core.FundInformationDoMapper">
  4. <resultMap id="BaseResultMap" type="com.smppw.analysis.domain.dataobject.FundInformationDo">
  5. <!--@mbg.generated-->
  6. <!--@Table fund_information-->
  7. <id column="id" property="id"/>
  8. <result column="p_fund_id" property="pFundId"/>
  9. <result column="fund_id" property="fundId"/>
  10. <result column="fund_name" property="fundName"/>
  11. <result column="fund_short_name" property="fundShortName"/>
  12. <result column="fund_structure" property="fundStructure"/>
  13. <result column="fund_type" property="fundType"/>
  14. <result column="public_fund_type" property="publicFundType"/>
  15. <result column="pub_fund_type" property="pubFundType"/>
  16. <result column="pub_sub_fund_type" property="pubSubFundType"/>
  17. <result column="fund_characteristic" property="fundCharacteristic"/>
  18. <result column="base_currency" property="baseCurrency"/>
  19. <result column="inception_date" property="inceptionDate"/>
  20. <result column="domicile" property="domicile"/>
  21. <result column="primary_benchmark_id" property="primaryBenchmarkId"/>
  22. <result column="secondary_benchmark" property="secondaryBenchmark"/>
  23. <result column="lockup_period" property="lockupPeriod"/>
  24. <result column="lockup_period_unit" property="lockupPeriodUnit"/>
  25. <result column="lockup_period2" property="lockupPeriod2"/>
  26. <result column="lock_period" property="lockPeriod"/>
  27. <result column="lock_period_unit" property="lockPeriodUnit"/>
  28. <result column="open_day" property="openDay"/>
  29. <result column="redemption_day" property="redemptionDay"/>
  30. <result column="duration" property="duration"/>
  31. <result column="initial_unit_value" property="initialUnitValue"/>
  32. <result column="investment_scope" property="investmentScope"/>
  33. <result column="investment_objective" property="investmentObjective"/>
  34. <result column="fund_portfolio" property="fundPortfolio"/>
  35. <result column="investment_restriction" property="investmentRestriction"/>
  36. <result column="fund_investment_philosophy" property="fundInvestmentPhilosophy"/>
  37. <result column="fund_strategy_description" property="fundStrategyDescription"/>
  38. <result column="investment_process" property="investmentProcess"/>
  39. <result column="advisor_id" property="advisorId"/>
  40. <result column="custodian_id" property="custodianId"/>
  41. <result column="broker_id" property="brokerId"/>
  42. <result column="broker_future_id" property="brokerFutureId"/>
  43. <result column="liquidation_agency_id" property="liquidationAgencyId"/>
  44. <result column="trust_id" property="trustId"/>
  45. <result column="administrator_id" property="administratorId"/>
  46. <result column="legal_counsel_id" property="legalCounselId"/>
  47. <result column="auditor_id" property="auditorId"/>
  48. <result column="general_service_id" property="generalServiceId"/>
  49. <result column="issuer_id" property="issuerId"/>
  50. <result column="nav_frequency" property="navFrequency"/>
  51. <result column="performance_disclosure_mark" property="performanceDisclosureMark"/>
  52. <result column="performance_disclosure_type" property="performanceDisclosureType"/>
  53. <result column="IsVisible" property="isvisible"/>
  54. <result column="manager_type" property="managerType"/>
  55. <result column="begin_member_cnt" property="beginMemberCnt"/>
  56. <result column="register_period" property="registerPeriod"/>
  57. <result column="zjx_last_info_update_time" property="zjxLastInfoUpdateTime"/>
  58. <result column="special_tips" property="specialTips"/>
  59. <result column="amac_url" property="amacUrl"/>
  60. <result column="raise_type" property="raiseType"/>
  61. <result column="risk_return_desc" property="riskReturnDesc"/>
  62. <result column="creatorid" property="creatorid"/>
  63. <result column="createtime" property="createtime"/>
  64. <result column="updaterid" property="updaterid"/>
  65. <result column="updatetime" property="updatetime"/>
  66. <result column="isvalid" property="isvalid"/>
  67. <result column="register_number" property="registerNumber"/>
  68. <result column="istiered" property="istiered"/>
  69. <result column="istiered_desc" property="istieredDesc"/>
  70. <result column="register_date" property="registerDate"/>
  71. <result column="is_ranking" property="isRanking"/>
  72. <result column="is_rating" property="isRating"/>
  73. <result column="nav_source" property="navSource"/>
  74. <result column="contract_name" property="contractName"/>
  75. <result column="contract_path" property="contractPath"/>
  76. <result column="is_authorized" property="isAuthorized"/>
  77. <result column="is_in_research" property="isInResearch"/>
  78. <result column="visible_ctrl" property="visibleCtrl"/>
  79. <result column="is_nav_visible" property="isNavVisible"/>
  80. <result column="is_nav_visible_org" property="isNavVisibleOrg"/>
  81. <result column="is_fee_before" property="isFeeBefore"/>
  82. <result column="is_deduct_reward" property="isDeductReward"/>
  83. <result column="valuation_institution_id" property="valuationInstitutionId"/>
  84. <result column="trust_register_number" property="trustRegisterNumber"/>
  85. <result column="is_consignment" property="isConsignment"/>
  86. <result column="is_qdii" property="isQdii"/>
  87. <result column="is_exclusive" property="isExclusive"/>
  88. <result column="is_show_independent" property="isShowIndependent"/>
  89. <result column="trust_apply_register_date" property="trustApplyRegisterDate"/>
  90. <result column="trust_publicity_date" property="trustPublicityDate"/>
  91. <result column="trust_main_industry" property="trustMainIndustry"/>
  92. <result column="trust_property_application" property="trustPropertyApplication"/>
  93. <result column="trust_function" property="trustFunction"/>
  94. <result column="is_amac_show" property="isAmacShow"/>
  95. </resultMap>
  96. <sql id="Base_Column_List">
  97. <!--@mbg.generated-->
  98. id,
  99. p_fund_id,
  100. fund_id,
  101. fund_name,
  102. fund_short_name,
  103. fund_structure,
  104. fund_type,
  105. public_fund_type,
  106. pub_fund_type,
  107. pub_sub_fund_type,
  108. fund_characteristic,
  109. base_currency,
  110. inception_date,
  111. domicile,
  112. primary_benchmark_id,
  113. secondary_benchmark,
  114. lockup_period,
  115. lockup_period_unit,
  116. lockup_period2,
  117. lock_period,
  118. lock_period_unit,
  119. open_day,
  120. redemption_day,
  121. duration,
  122. initial_unit_value,
  123. investment_scope,
  124. investment_objective,
  125. fund_portfolio,
  126. investment_restriction,
  127. fund_investment_philosophy,
  128. fund_strategy_description,
  129. investment_process,
  130. advisor_id,
  131. custodian_id,
  132. broker_id,
  133. broker_future_id,
  134. liquidation_agency_id,
  135. trust_id,
  136. administrator_id,
  137. legal_counsel_id,
  138. auditor_id,
  139. general_service_id,
  140. issuer_id,
  141. nav_frequency,
  142. performance_disclosure_mark,
  143. performance_disclosure_type,
  144. IsVisible,
  145. manager_type,
  146. begin_member_cnt,
  147. register_period,
  148. zjx_last_info_update_time,
  149. special_tips,
  150. amac_url,
  151. raise_type,
  152. risk_return_desc,
  153. creatorid,
  154. createtime,
  155. updaterid,
  156. updatetime,
  157. isvalid,
  158. register_number,
  159. istiered,
  160. istiered_desc,
  161. register_date,
  162. is_ranking,
  163. is_rating,
  164. nav_source,
  165. contract_name,
  166. contract_path,
  167. is_authorized,
  168. is_in_research,
  169. visible_ctrl,
  170. is_nav_visible,
  171. is_nav_visible_org,
  172. is_fee_before,
  173. is_deduct_reward,
  174. valuation_institution_id,
  175. trust_register_number,
  176. is_consignment,
  177. is_qdii,
  178. is_exclusive,
  179. is_show_independent,
  180. trust_apply_register_date,
  181. trust_publicity_date,
  182. trust_main_industry,
  183. trust_property_application,
  184. trust_function,
  185. is_amac_show
  186. </sql>
  187. <select id="listFundInfo" resultMap="BaseResultMap">
  188. select *
  189. from rz_hfdb_core.fund_information where isvalid = 1
  190. AND fund_id in
  191. <foreach collection="fundIdList" item="fundId" index="index" open="(" separator="," close=")">
  192. #{fundId}
  193. </foreach>
  194. </select>
  195. <select id="getManagerFundFeature" resultType="java.util.Map">
  196. SELECT ds.strategy_name, COUNT(t4.first_strategy) as countSum
  197. FROM rz_hfdb_core.`fund_information` t1
  198. INNER JOIN rz_hfdb_core.`fund_status` t2 ON (t1.fund_id = t2.fund_id)
  199. INNER JOIN rz_hfdb_core.fund_manager_mapping t3 ON (t1.`fund_id` = t3.fund_id)
  200. INNER JOIN rz_hfdb_core.`fund_strategy` t4 ON t4.`fund_id` = t1.`fund_id`
  201. INNER JOIN rz_hfdb_core.dict_strategy ds on t4.first_strategy = ds.strategy_code and ds.isvalid = 1
  202. WHERE (t1.fund_type NOT IN (5, -1, 9, 10, 11, 12, 13) OR t1.raise_type = 2)
  203. AND t3.isvalid = 1
  204. and t3.fund_manager_id = #{managerId}
  205. AND t1.isvalid = 1
  206. AND t3.isvisible = 1
  207. group by t4.first_strategy
  208. ORDER BY countSum desc
  209. </select>
  210. <select id="getFundByFundId" resultMap="BaseResultMap">
  211. select *
  212. from rz_hfdb_core.`fund_information`
  213. where fund_id = #{fundId}
  214. and isvalid = 1
  215. </select>
  216. <select id="getFundRankByCall" resultType="hashmap" parameterType="hashmap" statementType="CALLABLE">
  217. CALL rz_hfdb_core.sp_get_fund_strategy_year_ret_pro(1,null,#{rankDate,mode=IN},#{fundId,mode=IN},#{indexIds,mode=IN},#{indicator,mode=IN},null)
  218. </select>
  219. <select id="getSameCompanyFundIds" resultType="com.smppw.analysis.domain.dataobject.FundSimilarDo" parameterType="hashmap">
  220. select t.fund_id as fundId,
  221. t.fund_short_name as fundName,
  222. fs.first_strategy as strategy,
  223. fs.second_strategy as subStrategy,
  224. fs.third_strategy as thirdStrategy,
  225. fp.ret_ytd as retYtd,
  226. fp.ret_1y as ret1y,
  227. fp.ret_incep as retIncep,
  228. fp.ret_incep_a as annualIncep,
  229. frs.sharperatio_incep as shapeIncep,
  230. fr.maxdrawdown_incep as maxdownIncep,
  231. fr.stddev_incep as stdDevIncep
  232. from rz_hfdb_core.fund_information t
  233. inner join rz_hfdb_core.fund_strategy fs on t.fund_id = fs.fund_id and fs.isvalid = 1
  234. left join rz_hfdb_core.fund_performance fp
  235. on fp.fund_id = t.fund_id and fp.isvalid = 1 and fp.end_date = #{rankDate}
  236. left join rz_hfdb_core.fund_riskadjret_stats frs
  237. on frs.fund_id = t.fund_id and frs.isvalid = 1 and frs.end_date = #{rankDate}
  238. left join rz_hfdb_core.fund_risk_stats fr
  239. on fr.fund_id = t.fund_id and fr.isvalid = 1 and fr.end_date = #{rankDate}
  240. where t.trust_id = #{trustId} and t.isvalid = 1
  241. and (fs.third_strategy = #{strategy} or fs.second_strategy = #{strategy})
  242. and (select count(1) as cnt
  243. from rz_hfdb_core.fund_information a
  244. join ${tableName} b on a.fund_id = b.fund_id and b.isvalid = 1
  245. where b.price_date > #{startDate}
  246. and a.fund_id = t.fund_id) > 0
  247. limit 100
  248. </select>
  249. <select id="getSameStrategyFundIds" parameterType="hashmap" resultType="com.smppw.analysis.domain.dataobject.FundSimilarDo">
  250. select t.fund_id as fundId,
  251. t.fund_short_name as fundName,
  252. fs.first_strategy as strategy,
  253. fs.second_strategy as subStrategy,
  254. fs.third_strategy as thirdStrategy,
  255. fp.ret_ytd as retYtd,
  256. fp.ret_1y as ret1y,
  257. fp.ret_incep as retIncep,
  258. fp.ret_incep_a as annualIncep,
  259. frs.sharperatio_incep as shapeIncep,
  260. fr.maxdrawdown_incep as maxdownIncep,
  261. fr.stddev_incep as stdDevIncep
  262. from rz_hfdb_core.fund_information t
  263. inner join rz_hfdb_core.fund_strategy fs on t.fund_id = fs.fund_id and fs.isvalid = 1
  264. inner join ${tableName} c
  265. on t.fund_id = c.fund_id and c.indicator_id = 1
  266. left join rz_hfdb_core.fund_performance fp
  267. on fp.fund_id = t.fund_id and fp.isvalid = 1 and fp.end_date = #{rankDate}
  268. left join rz_hfdb_core.fund_riskadjret_stats frs
  269. on frs.fund_id = t.fund_id and frs.isvalid = 1 and frs.end_date = #{rankDate}
  270. left join rz_hfdb_core.fund_risk_stats fr
  271. on fr.fund_id = t.fund_id and fr.isvalid = 1 and fr.end_date = #{rankDate}
  272. where t.isvalid = 1
  273. and (fs.third_strategy = #{strategy} or fs.second_strategy = #{strategy})
  274. and c.end_date = #{rankDate}
  275. and c.indicator_id = 1
  276. and c.isvalid = 1
  277. and c.absrank_1y <![CDATA[<=]]> #{rankNum}
  278. limit #{rankNum}
  279. </select>
  280. <select id="getFundFee" resultType="com.smppw.analysis.domain.dataobject.FundFeeDo">
  281. select t1.fund_id as `fundId`,
  282. IF(t2.min_investment_share = -1, '管理人未设置',concat(t2.min_investment_share)) as `minInvestmentShare`
  283. , IF(t1.lockup_period = -1, '不确定', concat(t1.lockup_period, '月')) as `lockupPeriod`
  284. , IF(t2.subscription_fee = -1, '管理人未设置',
  285. t2.subscription_fee) as `subscriptionFee`
  286. , t2.subscription_fee_note as `subscriptionFeeNote`
  287. , IF(t2.redemption_fee = -1, '管理人未设置',
  288. t2.redemption_fee) as `redemptionFee`
  289. , t2.redemption_fee_note as `redemptionFeeNote`
  290. , case t1.duration
  291. when -1 then '不确定'
  292. when 0 then '无固定期限'
  293. when 999999 then '永续'
  294. else concat(t1.duration, '月') end as `duration`
  295. , t1.open_day as `openDay`
  296. , IF(t2.managementfee_bank = -1, '管理人未设置',
  297. t2.managementfee_bank) as `managementfeeBank`
  298. , IF(t2.managementfee_consult = -1, '管理人未设置',
  299. t2.managementfee_consult) as `managementfeeConsult`
  300. , IF(t2.managementfee_trust =-1.000000, '管理人未设置',
  301. t2.managementfee_trust) as `managementFee`
  302. , IF(t2.performance_fee = -1, '管理人未设置',
  303. t2.performance_fee) as `performanceFee`
  304. , t2.performance_fee_note as `performanceFeeNote`
  305. , case t2.accrued_way
  306. when 1 then '份额计提'
  307. when 2 then '净值计提'
  308. when 3
  309. then '混合' end as `accruedWay`
  310. , t2.accrued_method as `accruedMethod`
  311. , t2.accrued_frequency as `accruedFrequency`
  312. , IF(t2.guard_line =-1, '管理人未设置',
  313. t2.guard_line ) as `guardLine`
  314. , case t1.lock_period
  315. when -1 then '不确定'
  316. when 0 then '无锁定期'
  317. else (IF(t1.lock_period_unit = 1, concat(t1.lockup_period, '天'),
  318. concat(t1.lockup_period, '月'))) end as `lockPeriod`
  319. , t1.redemption_day as `redemptionDay`
  320. , CASE t1.base_currency
  321. WHEN 1 THEN '人民币'
  322. WHEN 2 THEN '港币'
  323. WHEN 3 THEN '美元'
  324. WHEN 4 THEN '份'
  325. ELSE '其他'
  326. END AS `baseCurrency`
  327. , t2.subsequent_investment_share as `subsequentInvestmentShare`
  328. , IF(t2.stop_loss_line =-1, '管理人未设置',
  329. t2.stop_loss_line ) as `stopLossLine`
  330. from rz_hfdb_core.`fund_information` t1
  331. inner join rz_hfdb_core.fund_rate_mapping t2 on t1.fund_id = t2.fund_id
  332. where t1.fund_id = #{fundId}
  333. </select>
  334. <select id="listFundManagerChangeHistory"
  335. resultType="com.smppw.analysis.domain.dataobject.ManualFundManagerChangeDo">
  336. select t1.fund_id as fundId,
  337. t2.fund_manager_id as managerId,
  338. t3.personnel_name as managerName,
  339. t2.management_start_date as startDate,
  340. t2.management_end_date as endDate
  341. from rz_hfdb_core.fund_information t1
  342. join rz_hfdb_core.fund_manager_mapping t2
  343. on t1.fund_id = t2.fund_id and t2.isvalid = 1
  344. join rz_hfdb_core.personnel_information t3
  345. on t2.fund_manager_id = t3.personnel_id and t3.isvalid = 1
  346. where t1.isvalid = 1
  347. and t1.fund_id = #{fundId}
  348. order by startDate desc
  349. </select>
  350. <select id="listMfManagerFundNumByManagerId"
  351. resultType="com.smppw.analysis.domain.dataobject.MfManagerFundNumDo">
  352. select t1.personnel_id as managerId,
  353. t2.fund_id as fundId,
  354. t2.management_start_date as startDate,
  355. t2.management_end_date as endDate,
  356. t3.fund_status as status
  357. from rz_hfdb_core.personnel_information t1
  358. join rz_hfdb_core.fund_manager_mapping t2
  359. on t1.personnel_id = t2.fund_manager_id and t2.isvalid = 1
  360. join rz_hfdb_core.fund_status t3 on t2.fund_id = t3.fund_id and t3.isvalid=1
  361. where t1.isvalid = 1
  362. and t1.personnel_id in
  363. <foreach collection="managerIdList" item="managerId" index="index" open="(" separator="," close=")">
  364. #{managerId}
  365. </foreach>
  366. </select>
  367. <select id="queryFundInfoList" resultType="com.smppw.analysis.domain.dataobject.info.FundInfoDO">
  368. select t.fund_id as fundId,
  369. t.fund_name as fundName,
  370. t.fund_short_name as fundShortName,
  371. t.register_number as registerNumber,
  372. t.amac_url as amacUrl,
  373. t.raise_type as raiseType,
  374. t.inception_date as inceptionDate,
  375. t.primary_benchmark_id as primaryBenchmarkId,
  376. t.trust_id as trustId,
  377. fs.strategy as strategy,
  378. fs.substrategy as substrategy,
  379. fs.first_strategy as firstStrategy,
  380. fs.second_strategy as secondStrategy,
  381. fs.third_strategy as thirdStrategy,
  382. t2.fund_status as fundStatus,
  383. group_concat(t3.fund_manager_id) as managerIds
  384. from rz_hfdb_core.fund_information t
  385. inner join rz_hfdb_core.fund_strategy fs on t.fund_id = fs.fund_id and fs.isvalid = 1
  386. inner join rz_hfdb_core.fund_status t2 on t.fund_id = t2.fund_id and t2.isvalid = 1
  387. inner join fund_manager_mapping t3 on t.fund_id = t3.fund_id and t3.isvalid = 1 and t3.management_end_date is null
  388. where t.isvalid = 1 and t.fund_id in
  389. <foreach collection="fundIds" item="fundId" open="(" separator="," close=")">
  390. #{fundId}
  391. </foreach>
  392. </select>
  393. </mapper>