FundInfoCustomMapper.xml 2.87 KB
Newer Older
zp's avatar
zp committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
<?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.tanpu.fund.mapper.generator.custom.FundInfoCustomMapper">
    <select id="queryFundNavByCondition" resultType="string">

        select res.id from (select id from fund_info where nav_frequency &lt;= #{navFrequency} and delete_tag = 0 limit #{offset}, #{length}) res left join fund_status fs on
        res.id = fs.id where fs.fund_status in

        <foreach close=")" collection="fundStatus" item="listItem" open="(" separator=",">
            #{listItem}
        </foreach>

         and fs.delete_tag = 0

    </select>

    <select id="getFundInfoReport" resultType="java.util.HashMap">
        select t.id,count(t1.id) as count
         from fund_info t
         left join fund_file_record t1
         on t.id = t1.ref_id
         where t.id in(${ids}) and t1.type = 3 and t.delete_tag = 0 and t1.delete_tag = 0 group by t.id;
    </select>

    <select id="getFundInfoLastNet" parameterType="java.lang.String" resultType="com.tanpu.fund.entity.generator.FundNav">
        select price_date as priceDate, net_nav as nav from fund_count where fund_id in
        <foreach close=")" collection="list" item="fundId" open="(" separator=",">
            #{fundId}
        </foreach>
        AND delete_tag = 0
    </select>

张亚辉's avatar
张亚辉 committed
33
    <select id="getFundInfoNewNet" parameterType="java.lang.String" resultType="com.tanpu.fund.entity.generator.FundNav">
张亚辉's avatar
张亚辉 committed
34 35 36 37 38 39 40 41 42 43
        select
        res.id as id,
        res.fund_id as fundId,
        res.price_date as priceDate,
        res.nav as nav,
        res.cumulative_nav as cumulativeNav,
        res.cumulative_nav_withdrawal as cumulativeNavWithdrawal,
        res.ishigh_or_low as ishighOrLow,
        res.tohigh_nav_ratio as tohighNavRatio
        from
张亚辉's avatar
张亚辉 committed
44
        (SELECT fund_id, max(price_date) as price_date FROM fund_nav WHERE fund_id in
张亚辉's avatar
张亚辉 committed
45 46
        <foreach close=")" collection="list" item="fundId" open="(" separator=",">
            #{fundId}
张亚辉's avatar
张亚辉 committed
47 48
        </foreach> GROUP by fund_id) t
        left join fund_nav res on t.fund_id = res.fund_id and t.price_date = res.price_date
张亚辉's avatar
张亚辉 committed
49 50 51
    </select>

    <select id="getPrivateFundInfoNewNet" parameterType="java.lang.String" resultType="com.tanpu.fund.entity.generator.FundNav">
张亚辉's avatar
张亚辉 committed
52 53 54 55 56 57
        select
        res.id as id,
        res.fund_id as fundId,
        res.price_date as priceDate,
        res.nav as nav,
        res.cumulative_nav as cumulativeNav,
58
        res.cumulative_nav as cumulativeNavWithdrawal
张亚辉's avatar
张亚辉 committed
59
        from
张亚辉's avatar
张亚辉 committed
60
        (SELECT fund_id, max(price_date) as price_date FROM ifa_imported_fund_nav WHERE fund_id in
张亚辉's avatar
张亚辉 committed
61 62
        <foreach close=")" collection="list" item="fundId" open="(" separator=",">
            #{fundId}
张亚辉's avatar
张亚辉 committed
63 64
        </foreach> GROUP by fund_id) t
        left join ifa_imported_fund_nav res on t.fund_id = res.fund_id and t.price_date = res.price_date
张亚辉's avatar
张亚辉 committed
65 66
    </select>

zp's avatar
zp committed
67
</mapper>