KKSU
2024-07-22 4575ae4dbedd7046f4b7aeeb79b49059676e2201
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
181
182
183
184
185
186
187
188
<?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.DappStorageMapper">
 
 
    <select id="selectOneByDateDesc" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        select
               *
        from
            dapp_storage
        where
            date_format(create_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
        order by create_time desc
        limit 1
    </select>
 
 
    <select id="selectListByDateDesc" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        select
               *
        from
            dapp_storage
        where
            date_format(create_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
        order by create_time desc
        limit 1,99
    </select>
 
 
    <select id="selectListByDate" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        select
               *
        from
            dapp_storage
        where
            date_format(create_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
        order by create_time desc
    </select>
 
 
    <select id="selectListByDateFiveToFiver" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        select
            *
        from
            dapp_storage
        where
            create_time &gt;= #{startTime}
        order by create_time asc
    </select>
 
 
 
    <select id="selectAmountByDesc" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        select
            *
        from
            dapp_storage
        where
                date_format(create_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
        order by amount desc
            limit #{offset},#{count}
    </select>
 
 
    <select id="selectOneByCreateTimeDesc" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        SELECT
            *
        FROM
            dapp_storage
        ORDER BY
            create_time DESC
            limit #{offset},#{count}
    </select>
 
 
    <select id="selectByAmountDesc" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        SELECT
            *
        FROM
            dapp_storage
        where
                date_format(create_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
        ORDER BY
            amount DESC
            limit #{offset},#{count}
    </select>
 
 
    <select id="selectSumByAmountDesc" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        SELECT
            member_id memberId,
               sum(amount) amount
        FROM
            dapp_storage
        where
                date_format(create_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
        GROUP BY
            member_id
        ORDER BY
            amount DESC
            limit #{offset},#{count}
    </select>
 
 
    <select id="selectAmountByAmountDesc" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        select
            *
        from
            dapp_storage
        where
                member_id = #{memberId}
        order by amount desc
            limit #{offset},#{count}
    </select>
 
    <select id="selectListInPage" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        select
        a.*,
        b.address address
        from
        dapp_storage a
        left join dapp_member b on a.member_id = b.id
        <where>
            <if test="record.address != '' and record.address != null">
                and b.address = #{record.address}
            </if>
            <if test="record.state != null">
                and a.state = #{record.state}
            </if>
        </where>
        order by a.create_time desc
    </select>
 
 
    <select id="selectListGroupByMemberId" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        SELECT
            member_id
        FROM
            dapp_storage
        GROUP BY
            member_id
    </select>
 
 
    <select id="selectSumByAmountDescFiveToFive" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        SELECT
            member_id memberId,
            sum(amount) amount
        FROM
            dapp_storage
        where
            create_time &gt;= #{startTime}
        GROUP BY
            member_id
        ORDER BY
            amount DESC
            limit #{offset},#{count}
    </select>
 
 
    <select id="selectNewRecordByRefMemberId" resultType="cc.mrbird.febs.dapp.entity.DappStorage">
        SELECT
            *
        FROM
            dapp_storage
        WHERE
                member_id IN (
                SELECT
                    id
                FROM
                    dapp_member
                WHERE
                        referer_id = (
                        SELECT
                            invite_id
                        FROM
                            dapp_member
                        WHERE
                            member_id = #{memberId}
                    )
            )
        ORDER BY
            create_time DESC
            LIMIT 1
    </select>
 
 
</mapper>