xiaoyong931011
2023-08-28 88d0062538fa813f383372fb8ea05219d3947b12
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
<?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.*
        FROM
        member_coin_withdraw s
        left join dapp_member m on m.id = s.member_id
        <where>
            <if test="record != null" >
                <if test="record.currentUser != null">
                    and m.referer_id = (select invite_id from dapp_user_member_relate where user_id=#{record.currentUser})
                </if>
                <if test="record.isInside!=null and record.isInside!=''">
                    and s.is_inside= #{record.isInside}
                </if>
                <if test="record.address!=null and record.address!=''">
                    and s.address= #{record.address}
                </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="selectByFlowId" resultType="cc.mrbird.febs.dapp.entity.MemberCoinWithdrawEntity">
        SELECT
            a.*
        FROM
            member_coin_withdraw a
        where a.member_id = #{memberId}
          and a.flow_id = #{flowId}
    </select>
 
    <select id="selectByMemberIdAndStatus"  resultType="java.math.BigDecimal">
        SELECT
               IFNULL(sum(IFNULL(a.amount, 0)),0)
        FROM
            member_coin_withdraw a
        where a.member_id = #{memberId}
          and a.status = #{status}
    </select>
 
</mapper>