1
zj
2024-06-13 66c2ab8a29786a5ee15c649890c5ec3c876c4774
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
<?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.yami.trading.dao.user.MoneyLogMapper">
 
 
    <select id="pageMoneyLog" resultType="com.yami.trading.bean.user.dto.MoneyLogDto">
        SELECT
        m.*,
        u.user_name,
        u.user_code,
        u.role_name,
        ur.user_name AS recomUserName,
        ur.user_code AS recomUserCode
        FROM
        t_money_log m
        LEFT JOIN tz_user u ON m.user_id = u.user_id
        LEFT JOIN tz_user ur ON u.user_recom = ur.user_id
        WHERE
        1 =1
 
 
        <if test="rolename!=null and rolename!=''">
            and u.role_name=#{rolename}
        </if>
        <if test="userCode!='' and userCode!=null">
            and u.user_code=#{userCode}
        </if>
 
        <if test="userName!=null and userName!=''">
            and (u.user_name=#{userName} or u.user_code=#{userName})
        </if>
 
        <if test="log!=null and log!=''">
            and m.log  like  CONCAT('%', #{log}, '%')
        </if>
        <if test="category!=null and category!=''">
            and m.category=#{category}
        </if>
 
        <if test="startTime!=null and endTime!=null">
            and m.create_time BETWEEN #{startTime} and #{endTime}
        </if>
        <if test=" userIds !=null and userIds.size > 0">
            and m.user_id  in
            <foreach collection="userIds" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
 
 
        order by m.create_time desc
    </select>
 
 
    <select id="sumBSalance" resultType="java.util.HashMap">
        SELECT
            round(
                    sum(
                            IF
                                ( create_time >= date( #{nowTime}), amount, 0 )),
                    2
                ) AS dateamount,
            round( ifnull( sum( amount ), 0 ), 2 ) AS sumamount
        FROM
            t_money_log
        WHERE
            category =#{category}
          AND content_type =#{contentType}
          AND user_id =#{userId}
    </select>
</mapper>