123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.smppw.analysis.domain.mapper.core.FundInformationDoMapper">
- <resultMap id="BaseResultMap" type="com.smppw.analysis.domain.dataobject.FundInformationDo">
- <!--@mbg.generated-->
- <!--@Table fund_information-->
- <id column="id" property="id"/>
- <result column="p_fund_id" property="pFundId"/>
- <result column="fund_id" property="fundId"/>
- <result column="fund_name" property="fundName"/>
- <result column="fund_short_name" property="fundShortName"/>
- <result column="fund_structure" property="fundStructure"/>
- <result column="fund_type" property="fundType"/>
- <result column="public_fund_type" property="publicFundType"/>
- <result column="pub_fund_type" property="pubFundType"/>
- <result column="pub_sub_fund_type" property="pubSubFundType"/>
- <result column="fund_characteristic" property="fundCharacteristic"/>
- <result column="base_currency" property="baseCurrency"/>
- <result column="inception_date" property="inceptionDate"/>
- <result column="domicile" property="domicile"/>
- <result column="primary_benchmark_id" property="primaryBenchmarkId"/>
- <result column="secondary_benchmark" property="secondaryBenchmark"/>
- <result column="lockup_period" property="lockupPeriod"/>
- <result column="lockup_period_unit" property="lockupPeriodUnit"/>
- <result column="lockup_period2" property="lockupPeriod2"/>
- <result column="lock_period" property="lockPeriod"/>
- <result column="lock_period_unit" property="lockPeriodUnit"/>
- <result column="open_day" property="openDay"/>
- <result column="redemption_day" property="redemptionDay"/>
- <result column="duration" property="duration"/>
- <result column="initial_unit_value" property="initialUnitValue"/>
- <result column="investment_scope" property="investmentScope"/>
- <result column="investment_objective" property="investmentObjective"/>
- <result column="fund_portfolio" property="fundPortfolio"/>
- <result column="investment_restriction" property="investmentRestriction"/>
- <result column="fund_investment_philosophy" property="fundInvestmentPhilosophy"/>
- <result column="fund_strategy_description" property="fundStrategyDescription"/>
- <result column="investment_process" property="investmentProcess"/>
- <result column="advisor_id" property="advisorId"/>
- <result column="custodian_id" property="custodianId"/>
- <result column="broker_id" property="brokerId"/>
- <result column="broker_future_id" property="brokerFutureId"/>
- <result column="liquidation_agency_id" property="liquidationAgencyId"/>
- <result column="trust_id" property="trustId"/>
- <result column="administrator_id" property="administratorId"/>
- <result column="legal_counsel_id" property="legalCounselId"/>
- <result column="auditor_id" property="auditorId"/>
- <result column="general_service_id" property="generalServiceId"/>
- <result column="issuer_id" property="issuerId"/>
- <result column="nav_frequency" property="navFrequency"/>
- <result column="performance_disclosure_mark" property="performanceDisclosureMark"/>
- <result column="performance_disclosure_type" property="performanceDisclosureType"/>
- <result column="IsVisible" property="isvisible"/>
- <result column="manager_type" property="managerType"/>
- <result column="begin_member_cnt" property="beginMemberCnt"/>
- <result column="register_period" property="registerPeriod"/>
- <result column="zjx_last_info_update_time" property="zjxLastInfoUpdateTime"/>
- <result column="special_tips" property="specialTips"/>
- <result column="amac_url" property="amacUrl"/>
- <result column="raise_type" property="raiseType"/>
- <result column="risk_return_desc" property="riskReturnDesc"/>
- <result column="creatorid" property="creatorid"/>
- <result column="createtime" property="createtime"/>
- <result column="updaterid" property="updaterid"/>
- <result column="updatetime" property="updatetime"/>
- <result column="isvalid" property="isvalid"/>
- <result column="register_number" property="registerNumber"/>
- <result column="istiered" property="istiered"/>
- <result column="istiered_desc" property="istieredDesc"/>
- <result column="register_date" property="registerDate"/>
- <result column="is_ranking" property="isRanking"/>
- <result column="is_rating" property="isRating"/>
- <result column="nav_source" property="navSource"/>
- <result column="contract_name" property="contractName"/>
- <result column="contract_path" property="contractPath"/>
- <result column="is_authorized" property="isAuthorized"/>
- <result column="is_in_research" property="isInResearch"/>
- <result column="visible_ctrl" property="visibleCtrl"/>
- <result column="is_nav_visible" property="isNavVisible"/>
- <result column="is_nav_visible_org" property="isNavVisibleOrg"/>
- <result column="is_fee_before" property="isFeeBefore"/>
- <result column="is_deduct_reward" property="isDeductReward"/>
- <result column="valuation_institution_id" property="valuationInstitutionId"/>
- <result column="trust_register_number" property="trustRegisterNumber"/>
- <result column="is_consignment" property="isConsignment"/>
- <result column="is_qdii" property="isQdii"/>
- <result column="is_exclusive" property="isExclusive"/>
- <result column="is_show_independent" property="isShowIndependent"/>
- <result column="trust_apply_register_date" property="trustApplyRegisterDate"/>
- <result column="trust_publicity_date" property="trustPublicityDate"/>
- <result column="trust_main_industry" property="trustMainIndustry"/>
- <result column="trust_property_application" property="trustPropertyApplication"/>
- <result column="trust_function" property="trustFunction"/>
- <result column="is_amac_show" property="isAmacShow"/>
- </resultMap>
- <sql id="Base_Column_List">
- <!--@mbg.generated-->
- id,
- p_fund_id,
- fund_id,
- fund_name,
- fund_short_name,
- fund_structure,
- fund_type,
- public_fund_type,
- pub_fund_type,
- pub_sub_fund_type,
- fund_characteristic,
- base_currency,
- inception_date,
- domicile,
- primary_benchmark_id,
- secondary_benchmark,
- lockup_period,
- lockup_period_unit,
- lockup_period2,
- lock_period,
- lock_period_unit,
- open_day,
- redemption_day,
- duration,
- initial_unit_value,
- investment_scope,
- investment_objective,
- fund_portfolio,
- investment_restriction,
- fund_investment_philosophy,
- fund_strategy_description,
- investment_process,
- advisor_id,
- custodian_id,
- broker_id,
- broker_future_id,
- liquidation_agency_id,
- trust_id,
- administrator_id,
- legal_counsel_id,
- auditor_id,
- general_service_id,
- issuer_id,
- nav_frequency,
- performance_disclosure_mark,
- performance_disclosure_type,
- IsVisible,
- manager_type,
- begin_member_cnt,
- register_period,
- zjx_last_info_update_time,
- special_tips,
- amac_url,
- raise_type,
- risk_return_desc,
- creatorid,
- createtime,
- updaterid,
- updatetime,
- isvalid,
- register_number,
- istiered,
- istiered_desc,
- register_date,
- is_ranking,
- is_rating,
- nav_source,
- contract_name,
- contract_path,
- is_authorized,
- is_in_research,
- visible_ctrl,
- is_nav_visible,
- is_nav_visible_org,
- is_fee_before,
- is_deduct_reward,
- valuation_institution_id,
- trust_register_number,
- is_consignment,
- is_qdii,
- is_exclusive,
- is_show_independent,
- trust_apply_register_date,
- trust_publicity_date,
- trust_main_industry,
- trust_property_application,
- trust_function,
- is_amac_show
- </sql>
- <select id="listFundInfo" resultMap="BaseResultMap">
- select *
- from rz_hfdb_core.fund_information where isvalid = 1
- AND fund_id in
- <foreach collection="fundIdList" item="fundId" index="index" open="(" separator="," close=")">
- #{fundId}
- </foreach>
- </select>
- <select id="getManagerFundFeature" resultType="java.util.Map">
- SELECT ds.strategy_name, COUNT(t4.first_strategy) as countSum
- FROM rz_hfdb_core.`fund_information` t1
- INNER JOIN rz_hfdb_core.`fund_status` t2 ON (t1.fund_id = t2.fund_id)
- INNER JOIN rz_hfdb_core.fund_manager_mapping t3 ON (t1.`fund_id` = t3.fund_id)
- INNER JOIN rz_hfdb_core.`fund_strategy` t4 ON t4.`fund_id` = t1.`fund_id`
- INNER JOIN rz_hfdb_core.dict_strategy ds on t4.first_strategy = ds.strategy_code and ds.isvalid = 1
- WHERE (t1.fund_type NOT IN (5, -1, 9, 10, 11, 12, 13) OR t1.raise_type = 2)
- AND t3.isvalid = 1
- and t3.fund_manager_id = #{managerId}
- AND t1.isvalid = 1
- AND t3.isvisible = 1
- group by t4.first_strategy
- ORDER BY countSum desc
- </select>
- <select id="getFundByFundId" resultMap="BaseResultMap">
- select *
- from rz_hfdb_core.`fund_information`
- where fund_id = #{fundId}
- and isvalid = 1
- </select>
- <select id="getFundRankByCall" resultType="hashmap" parameterType="hashmap" statementType="CALLABLE">
- 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)
- </select>
- <select id="getSameCompanyFundIds" resultType="com.smppw.analysis.domain.dataobject.FundSimilarDo" parameterType="hashmap">
- select t.fund_id as fundId,
- t.fund_short_name as fundName,
- fs.first_strategy as strategy,
- fs.second_strategy as subStrategy,
- fs.third_strategy as thirdStrategy,
- fp.ret_ytd as retYtd,
- fp.ret_1y as ret1y,
- fp.ret_incep as retIncep,
- fp.ret_incep_a as annualIncep,
- frs.sharperatio_incep as shapeIncep,
- fr.maxdrawdown_incep as maxdownIncep,
- fr.stddev_incep as stdDevIncep
- from rz_hfdb_core.fund_information t
- inner join rz_hfdb_core.fund_strategy fs on t.fund_id = fs.fund_id and fs.isvalid = 1
- left join rz_hfdb_core.fund_performance fp
- on fp.fund_id = t.fund_id and fp.isvalid = 1 and fp.end_date = #{rankDate}
- left join rz_hfdb_core.fund_riskadjret_stats frs
- on frs.fund_id = t.fund_id and frs.isvalid = 1 and frs.end_date = #{rankDate}
- left join rz_hfdb_core.fund_risk_stats fr
- on fr.fund_id = t.fund_id and fr.isvalid = 1 and fr.end_date = #{rankDate}
- where t.trust_id = #{trustId} and t.isvalid = 1
- and (fs.third_strategy = #{strategy} or fs.second_strategy = #{strategy})
- and (select count(1) as cnt
- from rz_hfdb_core.fund_information a
- join ${tableName} b on a.fund_id = b.fund_id and b.isvalid = 1
- where b.price_date > #{startDate}
- and a.fund_id = t.fund_id) > 0
- limit 100
- </select>
- <select id="getSameStrategyFundIds" parameterType="hashmap" resultType="com.smppw.analysis.domain.dataobject.FundSimilarDo">
- select t.fund_id as fundId,
- t.fund_short_name as fundName,
- fs.first_strategy as strategy,
- fs.second_strategy as subStrategy,
- fs.third_strategy as thirdStrategy,
- fp.ret_ytd as retYtd,
- fp.ret_1y as ret1y,
- fp.ret_incep as retIncep,
- fp.ret_incep_a as annualIncep,
- frs.sharperatio_incep as shapeIncep,
- fr.maxdrawdown_incep as maxdownIncep,
- fr.stddev_incep as stdDevIncep
- from rz_hfdb_core.fund_information t
- inner join rz_hfdb_core.fund_strategy fs on t.fund_id = fs.fund_id and fs.isvalid = 1
- inner join ${tableName} c
- on t.fund_id = c.fund_id and c.indicator_id = 1
- left join rz_hfdb_core.fund_performance fp
- on fp.fund_id = t.fund_id and fp.isvalid = 1 and fp.end_date = #{rankDate}
- left join rz_hfdb_core.fund_riskadjret_stats frs
- on frs.fund_id = t.fund_id and frs.isvalid = 1 and frs.end_date = #{rankDate}
- left join rz_hfdb_core.fund_risk_stats fr
- on fr.fund_id = t.fund_id and fr.isvalid = 1 and fr.end_date = #{rankDate}
- where t.isvalid = 1
- and (fs.third_strategy = #{strategy} or fs.second_strategy = #{strategy})
- and c.end_date = #{rankDate}
- and c.indicator_id = 1
- and c.isvalid = 1
- and c.absrank_1y <![CDATA[<=]]> #{rankNum}
- limit #{rankNum}
- </select>
- <select id="getFundFee" resultType="com.smppw.analysis.domain.dataobject.FundFeeDo">
- select t1.fund_id as `fundId`,
- IF(t2.min_investment_share = -1, '管理人未设置',concat(t2.min_investment_share)) as `minInvestmentShare`
- , IF(t1.lockup_period = -1, '不确定', concat(t1.lockup_period, '月')) as `lockupPeriod`
- , IF(t2.subscription_fee = -1, '管理人未设置',
- t2.subscription_fee) as `subscriptionFee`
- , t2.subscription_fee_note as `subscriptionFeeNote`
- , IF(t2.redemption_fee = -1, '管理人未设置',
- t2.redemption_fee) as `redemptionFee`
- , t2.redemption_fee_note as `redemptionFeeNote`
- , case t1.duration
- when -1 then '不确定'
- when 0 then '无固定期限'
- when 999999 then '永续'
- else concat(t1.duration, '月') end as `duration`
- , t1.open_day as `openDay`
- , IF(t2.managementfee_bank = -1, '管理人未设置',
- t2.managementfee_bank) as `managementfeeBank`
- , IF(t2.managementfee_consult = -1, '管理人未设置',
- t2.managementfee_consult) as `managementfeeConsult`
- , IF(t2.managementfee_trust =-1.000000, '管理人未设置',
- t2.managementfee_trust) as `managementFee`
- , IF(t2.performance_fee = -1, '管理人未设置',
- t2.performance_fee) as `performanceFee`
- , t2.performance_fee_note as `performanceFeeNote`
- , case t2.accrued_way
- when 1 then '份额计提'
- when 2 then '净值计提'
- when 3
- then '混合' end as `accruedWay`
- , t2.accrued_method as `accruedMethod`
- , t2.accrued_frequency as `accruedFrequency`
- , IF(t2.guard_line =-1, '管理人未设置',
- t2.guard_line ) as `guardLine`
- , case t1.lock_period
- when -1 then '不确定'
- when 0 then '无锁定期'
- else (IF(t1.lock_period_unit = 1, concat(t1.lockup_period, '天'),
- concat(t1.lockup_period, '月'))) end as `lockPeriod`
- , t1.redemption_day as `redemptionDay`
- , CASE t1.base_currency
- WHEN 1 THEN '人民币'
- WHEN 2 THEN '港币'
- WHEN 3 THEN '美元'
- WHEN 4 THEN '份'
- ELSE '其他'
- END AS `baseCurrency`
- , t2.subsequent_investment_share as `subsequentInvestmentShare`
- , IF(t2.stop_loss_line =-1, '管理人未设置',
- t2.stop_loss_line ) as `stopLossLine`
- from rz_hfdb_core.`fund_information` t1
- inner join rz_hfdb_core.fund_rate_mapping t2 on t1.fund_id = t2.fund_id
- where t1.fund_id = #{fundId}
- </select>
- <select id="listFundManagerChangeHistory"
- resultType="com.smppw.analysis.domain.dataobject.ManualFundManagerChangeDo">
- select t1.fund_id as fundId,
- t2.fund_manager_id as managerId,
- t3.personnel_name as managerName,
- t2.management_start_date as startDate,
- t2.management_end_date as endDate
- from rz_hfdb_core.fund_information t1
- join rz_hfdb_core.fund_manager_mapping t2
- on t1.fund_id = t2.fund_id and t2.isvalid = 1
- join rz_hfdb_core.personnel_information t3
- on t2.fund_manager_id = t3.personnel_id and t3.isvalid = 1
- where t1.isvalid = 1
- and t1.fund_id = #{fundId}
- order by startDate desc
- </select>
- <select id="listMfManagerFundNumByManagerId"
- resultType="com.smppw.analysis.domain.dataobject.MfManagerFundNumDo">
- select t1.personnel_id as managerId,
- t2.fund_id as fundId,
- t2.management_start_date as startDate,
- t2.management_end_date as endDate,
- t3.fund_status as status
- from rz_hfdb_core.personnel_information t1
- join rz_hfdb_core.fund_manager_mapping t2
- on t1.personnel_id = t2.fund_manager_id and t2.isvalid = 1
- join rz_hfdb_core.fund_status t3 on t2.fund_id = t3.fund_id and t3.isvalid=1
- where t1.isvalid = 1
- and t1.personnel_id in
- <foreach collection="managerIdList" item="managerId" index="index" open="(" separator="," close=")">
- #{managerId}
- </foreach>
- </select>
- <select id="queryFundInfoList" resultType="com.smppw.analysis.domain.dataobject.info.FundInfoDO">
- select t.fund_id as fundId,
- t.fund_name as fundName,
- t.fund_short_name as fundShortName,
- t.register_number as registerNumber,
- t.amac_url as amacUrl,
- t.raise_type as raiseType,
- t.inception_date as inceptionDate,
- t.primary_benchmark_id as primaryBenchmarkId,
- t.trust_id as trustId,
- fs.strategy as strategy,
- fs.substrategy as substrategy,
- fs.first_strategy as firstStrategy,
- fs.second_strategy as secondStrategy,
- fs.third_strategy as thirdStrategy,
- t2.fund_status as fundStatus,
- group_concat(t3.fund_manager_id) as managerIds
- from rz_hfdb_core.fund_information t
- inner join rz_hfdb_core.fund_strategy fs on t.fund_id = fs.fund_id and fs.isvalid = 1
- inner join rz_hfdb_core.fund_status t2 on t.fund_id = t2.fund_id and t2.isvalid = 1
- inner join fund_manager_mapping t3 on t.fund_id = t3.fund_id and t3.isvalid = 1 and t3.management_end_date is null
- where t.isvalid = 1 and t.fund_id in
- <foreach collection="fundIds" item="fundId" open="(" separator="," close=")">
- #{fundId}
- </foreach>
- </select>
- </mapper>
|