xiaoyong931011
2021-05-14 6ed309c5a80c36e752bfd799cbaba7665cf7364b
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?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.yunding.mapper.BasicSettingMapper">
 
 
    <select id="getOrderList" resultType="com.xcong.excoin.modules.yunding.entity.YdOrderEntity">
        SELECT
        *
        FROM
        yd_order a
        left join yd_product b on b.id = a.product_id
        left join member c on c.id = a.member_id
        <if test="record != null">
            <where>
                and a.type=1
                <if test="record.state != null" >
                    and a.state=#{record.state}
                </if>
                <if test="record.account!=null and record.account!=''">
                    and (c.phone = #{record.account} or c.email = #{record.account} or c.invite_id=#{record.account})
                </if>
            </where>
        </if>
        ORDER BY a.create_time DESC
    </select>
 
    <select id="getAgentOrderList" resultType="com.xcong.excoin.modules.yunding.vo.YdAgentOrderVo">
        SELECT
        *
        FROM
        yd_order a
        left join yd_basic_level_setting b on b.id = a.product_id
        left join member c on c.id = a.member_id
        <if test="record != null">
            <where>
                and a.type=2
                <if test="record.account!=null and record.account!=''">
                    and (c.phone = #{record.account} or c.email = #{record.account} or c.invite_id=#{record.account})
                </if>
            </where>
        </if>
        ORDER BY a.create_time DESC
    </select>
 
    <select id="getYdProductList" resultType="com.xcong.excoin.modules.yunding.entity.YdProductEntity">
        SELECT
        *
        FROM
        yd_product a
    </select>
 
    <select id="getYdMemberList" resultType="com.xcong.excoin.modules.yunding.vo.YdMemberVo">
        SELECT
        *
        FROM
        member c
        <if test="record != null">
            <where>
                <if test="record.account!=null and record.account!=''">
                    and (c.phone = #{record.account} or c.email = #{record.account} or c.invite_id=#{record.account})
                </if>
            </where>
        </if>
        ORDER BY c.create_time DESC
    </select>
 
    <select id="selectPowerByMemberIdAndState" resultType="java.lang.Integer">
        SELECT
            IFNULL(sum(quantity),0)
        FROM
            yd_order a
        where a.member_id = #{memberId}
          and a.state = #{state}
    </select>
 
    <select id="selectAmountByMemberId" resultType="java.math.BigDecimal">
        SELECT
            IFNULL(sum(amount),0)
        FROM
            yd_order a
        where a.member_id = #{memberId}
        and type = #{type}
    </select>
 
 
    <select id="selectChargeAmountByMemberIdAndStatus" resultType="java.math.BigDecimal">
        SELECT
            IFNULL(sum(amount),0)
        FROM
            member_coin_charge a
        where a.member_id = #{memberId}
          and a.status = #{status}
    </select>
 
    <select id="selectWithdrawAmountByMemberIdAndStatusAndIsInside" resultType="java.math.BigDecimal">
        SELECT
            IFNULL(sum(amount),0)
        FROM
            member_coin_withdraw a
        where a.member_id = #{memberId}
          and a.status = #{status}
          and a.is_inside = #{isInside}
    </select>
 
 
 
    <select id="selectAgentReturnByMemberId" resultType="java.math.BigDecimal">
        SELECT
            IFNULL(sum(amount),0)
        FROM
            member_account_money_change
        WHERE
            member_id = #{memberId}
          AND type = 6
          AND status = 1
    </select>
 
    <select id="seeAgentReturn" resultType="com.xcong.excoin.modules.member.entity.MemberAccountMoneyChangeEntity">
        SELECT
               b.phone phoneTo,
        a.content content,
        a.amount amount,
        a.symbol symbol,
        a.status status,
               c.phone phoneFrom,
               d.amount amountOrder,
               d.type typeOrder
        FROM
        member_account_money_change a
        left join member b on b.id = a.member_id
        left join member c on c.id = (
            select member_id from yd_order where id = a.withdraw_id
            )
        left join yd_order d on d.id = a.withdraw_id
        where a.type=6
                and a.member_id = #{record.id}
        ORDER BY a.create_time DESC
    </select>
 
    <select id="selectTotalProfitByMemberIdAndType" resultType="java.math.BigDecimal">
        SELECT
            IFNULL(sum(total_profit),0)
        FROM
            yd_order a
        where a.member_id = #{memberId}
          and a.type = #{type}
    </select>
 
    <select id="seeReturn" resultType="com.xcong.excoin.modules.member.entity.MemberAccountMoneyChangeEntity">
        SELECT
            a.content content,
            a.amount amount,
            a.symbol symbol,
            a.status status,
            b.phone phoneFrom,
            d.quantity quantityOrder,
            e.name name
        FROM
            member_account_money_change a
                left join member b on b.id = a.member_id
                left join yd_order d on d.id = a.withdraw_id
                left join yd_product e on e.id = d.product_id
        where a.type=4
          and a.member_id = #{record.id}
        ORDER BY a.create_time DESC
    </select>
 
    <select id="seeOrder" resultType="com.xcong.excoin.modules.yunding.entity.YdOrderEntity">
        SELECT
            *
        FROM
            yd_order a
                left join yd_product e on e.id = a.product_id
        where a.member_id = #{record.id}
        and a.type = 1
        ORDER BY a.buy_time DESC
    </select>
 
 
</mapper>