Helius
2021-09-07 1e4cab335b1cb68ad3438e522ea410c2d2e753ed
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
<?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.FollowFollowerOrderRelationDao">
 
 
    <select id="selectFollowerHoldingSymbolCnt" resultType="java.lang.Integer">
        select
            IFNULL(sum(b.symbol_cnt),0)
        from follow_follower_order_relation a, contract_hold_order b
        where a.order_id=b.id and a.order_type=1 and a.trade_member_id=#{tradeMemberId}
        and a.member_id=#{memberId}
    </select>
 
    <select id="selectHistoryOneByorderId" resultType="com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity">
        SELECT
            *
        FROM
            follow_follower_order_relation 
        WHERE order_id = #{orderId} and order_type = 2 
    </select>
    <select id="selectNowOneByorderId" resultType="com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity">
        SELECT
            *
        FROM
            follow_follower_order_relation 
        WHERE order_id = #{orderId} and order_type = 1
    </select>
 
    <select id="selectFollowHoldOrderByTradeOrderNo" resultType="com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity">
        select a.*
        from follow_follower_order_relation a, follow_follower_profit b
        where a.member_id=b.member_id and a.trade_order_no=#{orderNo} and b.is_follow=1
        and a.order_type=1
    </select>
 
    <select id="selectFollowOrderByTradeOrderNo" resultType="com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity">
        select a.*
        from follow_follower_order_relation a, follow_follower_profit b
        where a.member_id=b.member_id and a.trade_order_no=#{orderNo} and b.is_follow=1
          and a.order_type=2
    </select>
 
    <select id="selectTraderTotalProfit" resultType="java.math.BigDecimal">
        select sum(b.reward_amount)
        from follow_follower_order_relation a, contract_order b
        where a.order_id=b.id and a.trade_member_id=#{memberId}
    </select>
 
    <select id="selectTraderTotalProfitSelf" resultType="java.math.BigDecimal">
        select sum(reward_amount)
        from contract_order
        where member_id=#{memberId} and contract_type=2
    </select>
</mapper>