123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- <?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.simuwang.base.mapper.FundInfoMapper">
- <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.FundInfoDO">
- <id column="id" property="id"/>
- <result column="p_fund_id" property="pFundId"/>
- <result column="fund_name" property="fundName"/>
- <result column="fund_short_name" property="fundShortName"/>
- <result column="fund_type" property="fundType"/>
- <result column="manager_type" property="managerType"/>
- <result column="base_currency" property="baseCurrency"/>
- <result column="inception_date" property="inceptionDate"/>
- <result column="advisor_id" property="advisorId"/>
- <result column="issuer_id" property="issuerId"/>
- <result column="issuer_company_name" property="issuerCompanyName"/>
- <result column="advisor_company_name" property="advisorCompanyName"/>
- <result column="custodian_id" property="custodianId"/>
- <result column="register_number" property="registerNumber"/>
- <result column="register_date" property="registerDate"/>
- <result column="is_amac_show" property="isAmacShow"/>
- <result column="fund_status" property="fundStatus"/>
- <result column="amac_source_type" property="amacSourceType"/>
- <result column="investment_type" property="investmentType"/>
- <result column="liquidate_date" property="liquidateDate"/>
- <result column="performance_start_date" property="performanceStartDate"/>
- <result column="is_shareclass" property="isShareclass"/>
- <result column="trust_id" property="trustId"/>
- <result column="trust_company_name" property="trustCompanyName"/>
- <result column="createtime" property="createTime"/>
- <result column="updatetime" property="updateTime"/>
- <result column="isvalid" property="isvalid"/>
- </resultMap>
- <select id="searchFundInfoByKeyword" resultType="java.util.Map">
- select f.fund_id as "fundId",
- f.fund_short_name as "fundShortName",
- f.register_number as "registerNumber"
- from PPW_EMAIL.pvn_fund_info f where f.isvalid =1
- <if test="keyword != null and keyword !=''">
- 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},'%'))
- </if>
- limit #{offset},#{pageSize}
- </select>
- <select id="searchFundInfoList" resultType="com.simuwang.base.pojo.dos.FundInformationDO">
- select * from (
- select f.id as id,
- f.fund_id as fundId,
- f.fund_short_name as fundShortName,
- f.register_number as registerNumber,
- c.company_id as companyId,
- c.company_short_name as companyShortName,
- c.company_name as companyName,
- c.credit_code as creditCode,
- f.inception_date as inceptionDate,
- n.last_price_date as lastPriceDate,
- r.nav_frequency as navFrequency,
- r.asset_Frequency as assetFrequency,
- r.valuation_Frequency as valuationFrequency,
- r.frequency_remark as frequencyRemark
- from PPW_EMAIL.pvn_fund_info f
- left join PPW_EMAIL.pvn_company_info c on f.trust_id = c.company_id and c.isvalid =1
- 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
- on f.fund_id = n .fund_id
- left join PPW_EMAIL.fund_report_frequency r on r.fund_id = f.fund_id and r.isvalid =1
- where f.isvalid =1
- <if test="fundId != null and fundId !=''">
- and f.fund_id like concat('%',#{fundId},'%')
- </if>
- <if test="fundShortName != null and fundShortName !=''">
- and (f.fund_name like concat('%',#{fundShortName},'%') or f.fund_short_name like concat('%',#{fundShortName},'%') or f.register_number like concat('%',#{fundShortName},'%'))
- </if>
- <if test="companyShortName != null and companyShortName !=''">
- and (c.company_name like concat('%',#{companyShortName},'%') or c.company_short_name like concat('%',#{companyShortName},'%') or c.register_number like concat('%',#{companyShortName},'%'))
- </if>
- <if test="navFrequency != null and navFrequency !=''">
- and r.nav_frequency = #{navFrequency}
- </if>
- <if test="assetFrequency != null and assetFrequency !=''">
- and r.asset_Frequency = #{assetFrequency}
- </if>
- <if test="valuationFrequency != null and valuationFrequency !=''">
- and r.valuation_Frequency = #{valuationFrequency}
- </if>
- <if test="startDate != null and startDate !=''">
- and f.inception_date <![CDATA[ >= ]]> #{startDate}
- </if>
- <if test="endDate != null and endDate !=''">
- and f.inception_date <![CDATA[ <= ]]> #{endDate}
- </if>) a
- <choose>
- <when test="sort != null and sort !='' and sort=='lastPriceDate' and order != null and order !=''">
- order by
- CASE
- WHEN a.lastPriceDate IS NULL THEN 1
- ELSE 0
- END,
- a.lastPriceDate ${order}
- </when>
- <otherwise>
- order by a.lastPriceDate desc
- </otherwise>
- </choose>
- limit #{offset},#{pageSize}
- </select>
- <select id="queryFundByNameAndRegisterNumber" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
- select fund_id as fundId,
- fund_name as fundName,
- register_number as registerNumber
- from PPW_EMAIL.pvn_fund_info
- where isvalid = 1
- and fund_name = #{fundName}
- and register_number = #{registerNumber}
- </select>
- <select id="queryFundByName" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
- select fund_id as fundId,
- fund_name as fundName,
- register_number as registerNumber
- from PPW_EMAIL.pvn_fund_info
- where isvalid = 1
- and fund_name = #{fundName}
- </select>
- <select id="queryFundByRegisterNumber" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
- select fund_id as fundId,
- fund_name as fundName,
- register_number as registerNumber
- from PPW_EMAIL.pvn_fund_info
- where isvalid = 1
- and register_number = #{registerNumber}
- </select>
- <select id="countFundInfoByKeyword" resultType="java.lang.Long"
- parameterType="com.simuwang.base.pojo.dto.query.FundInputPageQuery">
- select count(f.fund_id)
- from PPW_EMAIL.pvn_fund_info f where f.isvalid =1
- <if test="keyword != null and keyword !=''">
- 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},'%'))
- </if>
- </select>
- <select id="countFundInfo" resultType="java.lang.Long"
- parameterType="com.simuwang.base.pojo.dto.query.FundInfoPageQuery">
- select count(f.fund_id)
- from PPW_EMAIL.pvn_fund_info f
- left join PPW_EMAIL.pvn_company_info c on f.trust_id = c.company_id and c.isvalid =1
- 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
- on f.fund_id = n .fund_id
- left join PPW_EMAIL.fund_report_frequency r on r.fund_id = f.fund_id and r.isvalid =1
- where f.isvalid =1
- <if test="fundId != null and fundId !=''">
- and f.fund_id like concat('%',#{fundId},'%')
- </if>
- <if test="fundShortName != null and fundShortName !=''">
- and (f.fund_name like concat('%',#{fundShortName},'%') or f.fund_short_name like concat('%',#{fundShortName},'%') or f.register_number like concat('%',#{fundShortName},'%'))
- </if>
- <if test="companyShortName != null and companyShortName !=''">
- and (c.company_name like concat('%',#{companyShortName},'%') or c.company_short_name like concat('%',#{companyShortName},'%') or c.register_number like concat('%',#{companyShortName},'%'))
- </if>
- <if test="navFrequency != null and navFrequency !=''">
- and r.nav_frequency = #{navFrequency}
- </if>
- <if test="assetFrequency != null and assetFrequency !=''">
- and r.asset_Frequency = #{assetFrequency}
- </if>
- <if test="valuationFrequency != null and valuationFrequency !=''">
- and r.valuation_Frequency = #{valuationFrequency}
- </if>
- <if test="startDate != null and startDate !=''">
- and f.inception_date <![CDATA[ >= ]]> #{startDate}
- </if>
- <if test="endDate != null and endDate !=''">
- and f.inception_date <![CDATA[ <= ]]> #{endDate}
- </if>
- </select>
- <select id="getFundNameByFundId" resultType="java.lang.String" parameterType="java.lang.String">
- select fund_name from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
- </select>
- <select id="queryFundIdByName" resultType="java.lang.String" parameterType="java.lang.String">
- select fund_id
- from PPW_EMAIL.pvn_fund_info
- where isvalid = 1
- and fund_name = #{fundName} limit 1
- </select>
- <select id="getCompanyNameByFundId" resultType="java.lang.String" parameterType="java.lang.String">
- select c.company_name from PPW_EMAIL.pvn_company_info c
- join PPW_EMAIL.pvn_fund_info info on info.trust_id=c.company_id
- where info.fund_id=#{fundId} and info.isvalid=1 and c.isvalid=1
- </select>
- <select id="getLiquidateDateByFundId" resultType="java.lang.String" parameterType="java.lang.String">
- select liquidate_date from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
- </select>
- <select id="getFundIdByCompanyId" resultType="java.lang.String" parameterType="java.lang.String">
- 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
- where info.isvalid=1 and c.isvalid=1 and c.company_id=#{companyId}
- </select>
- <select id="getInceptionDateByFundId" resultType="java.lang.String" parameterType="java.lang.String">
- select inception_date from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
- </select>
- <select id="queryFundAndTrustByRegisterNumber" resultType="com.simuwang.base.pojo.dos.FundAndCompanyInfoDO">
- select t.fund_id as fundId,
- t.fund_name as fundName,
- t.register_number as registerNumber,
- t1.company_id as companyId,
- t1.company_name as companyName
- from PPW_EMAIL.pvn_fund_info t
- left join PPW_EMAIL.pvn_company_info t1 on t1.isvalid = 1 and t1.company_id = t.trust_id
- where t.isvalid = 1
- and t.register_number = #{registerNumber}
- limit 1
- </select>
- <select id="searchFundDetail" resultMap="BaseResultMap"
- parameterType="java.lang.String">
- select info.id,info.p_fund_id,info.fund_id,info.fund_name,
- info.fund_short_name,info.fund_type,info.manager_type,
- info.base_currency,info.inception_date,info.advisor_id,a.company_name as advisor_company_name,
- info.issuer_id,ic.company_name as issuer_company_name,t.company_name as trust_company_name,info.custodian_id,info.trust_id,
- info.register_number,info.register_date,info.createtime,
- info.is_amac_show,info.fund_status,info.amac_source_type,
- info.investment_type,info.liquidate_date,info.performance_start_date,
- info.is_shareclass,info.amac_url
- from PPW_EMAIL.pvn_fund_info info
- left join PPW_EMAIL.pvn_company_info a
- on info.advisor_id = a.company_id and a.isvalid=1
- left join PPW_EMAIL.pvn_company_info t
- on info.trust_id = t.company_id and t.isvalid=1
- left join PPW_EMAIL.pvn_company_info ic
- on info.issuer_id = ic.company_id and ic.isvalid=1
- where info.isvalid=1 and info.fund_id=#{fundId}
- </select>
- <select id="countFundTotal" resultType="java.lang.Long">
- select count(1) from PPW_EMAIL.pvn_fund_info where isvalid=1
- </select>
- </mapper>
|