Helius
2021-05-18 9739e12c89e42a2b445801fea0ad958c5f08281c
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?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.xcong.excoin.modules.documentary.dao.FollowTraderProfitInfoDao">
    
    <select id="selectFollowTraderProfitInfoEntity" resultType="com.xcong.excoin.modules.documentary.vo.FollowTraderProfitInfoVo">
        select * from follow_trader_profit_info f
            left join member m on f.member_id = m.id
            left join follow_trader_info t on t.member_id = f.member_id
        <where>
            m.is_trader = 1
            <if test="record.type != null and record.type != '' ">
                and t.is_set_frist = #{record.type}
            </if>
            <if test="record.nickname != null and record.nickname != '' ">
                and t.nickname like concat('%',#{record.nickname},'%')
            </if>
        </where>
        order by
        <if test="record.totalProfitRatioSc != null and record.totalProfitRatioSc != '' and record.totalProfitRatioSc == 1" >
            f.total_profit_ratio,
        </if>
        <if test="record.totalProfitRatioSc != null and record.totalProfitRatioSc != '' and record.totalProfitRatioSc == 2" >
            f.total_profit_ratio desc,
        </if>
        <if test="record.winRateSc != null and record.winRateSc != '' and record.winRateSc == 1" >
            f.win_rate,
        </if>
        <if test="record.winRateSc != null and record.winRateSc != '' and record.winRateSc == 2" >
            f.win_rate desc,
        </if>
        <if test="record.totalFollowerCntSc != null and record.totalFollowerCntSc != '' and record.totalFollowerCntSc == 1" >
            f.total_follower_cnt,
        </if>
        <if test="record.totalFollowerCntSc != null and record.totalFollowerCntSc != '' and record.totalFollowerCntSc == 2" >
            f.total_follower_cnt desc,
        </if>
        f.id desc
    </select>
    
    <select id="selectOneByMemberId" resultType="com.xcong.excoin.modules.documentary.vo.FollowTraderProfitInfoVo">
        select * from follow_trader_profit_info where member_id = #{memberId} 
    </select>
    
    <select id="selectHistoryOrderRecords" resultType="com.xcong.excoin.modules.documentary.vo.HistoryOrderRecordsVo">
        SELECT
            symbol,
            order_type orderType,
            lever_ratio leverRatio,
            opening_price openingPrice,
            closing_price closingPrice,
            reward_ratio rewardRatio,
            opening_time openingTime,
            closing_time closingTime,
            order_no orderNo
        FROM
            contract_order 
        WHERE 
            member_id = #{memberId} 
            and contract_type = 2
            and order_type in (3,4)
            and closing_type not in (4,5)
        order by opening_time desc
    </select>
 
    <select id="selectTraderInfoProfitByMemberId" resultType="com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity">
        select * from follow_trader_profit_info
        where member_id=#{memberId}
    </select>
</mapper>