xiaoyong931011
2022-11-25 e5ec3bbbac92f8c49ae1ebd420a7b721c3800239
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
<?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="cc.mrbird.febs.dapp.mapper.MemberCoinWithdrawDao">
 
    <select id="findMemberWithdrawCoinInPage" resultType="cc.mrbird.febs.dapp.vo.AdminMemberCoinWithdrawVo">
        SELECT
        s.*,
        (select a.username from dapp_member a where s.address = a.invite_id and s.is_inside = 'Y') usernameIn,
        m.username username
        FROM
        member_coin_withdraw s
        left join dapp_member m on m.id = s.member_id
        <where>
            <if test="record != null" >
                <if test="record.username!=null and record.username!=''">
                    and m.username = #{record.username}
                </if>
                <if test="record.description!=null and record.description!=''">
                    and (s.member_id in (select id from dapp_member where FIND_IN_SET(#{record.description}, referer_ids)))
                </if>
                <if test="record.isInside!=null and record.isInside!=''">
                    and s.is_inside= #{record.isInside}
                </if>
                <if test="record.status!=null and record.status!=''">
                    and s.status= #{record.status}
                </if>
            </if>
        </where>
        order by s.create_time desc
    </select>
 
    <select id="selectByMemberIdAndCreateTime" resultType="java.lang.Integer">
        SELECT
        count (a.id)
        FROM
        member_coin_withdraw a
        where a.member_id = #{memberId}
            and date_format(a.create_time, '%Y-%m-%d') = #{createTime}
            and a.is_inside = #{type}
    </select>
 
    <select id="selectTotalAmountByCreateTimeAndInviteId" resultType="cc.mrbird.febs.dapp.vo.AdminMemberWithdrawVo">
        SELECT
            IFNULL(sum(amount),0) AS totalWithdraw,
            count(id) AS sheetOut
        FROM
            member_coin_withdraw
        WHERE
        is_inside = 'N' and status = 2
        and date_format(create_time, '%Y-%m-%d') = date_format(#{createTime}, '%Y-%m-%d')
        <if test="description !=null and description != ''">
            and member_id IN (
            SELECT
            id
            FROM
            dapp_member
            WHERE
            FIND_IN_SET(#{description}, referer_ids)
            )
        </if>
 
    </select>
 
    <select id="selectTotalAmountByMemberIdAndType" resultType="java.math.BigDecimal">
        SELECT
        IFNULL(sum(amount),0)
        FROM
        member_coin_withdraw
        WHERE
        is_inside = #{inside}
        and member_id = #{memberId}
    </select>
 
</mapper>