admin
2018-12-25 4cb15e222cd7d099d533ccbeb7f9a8cd99bf180c
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
package com.yeshi.fanli.dao.mybatis.hongbao;
 
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
 
import org.apache.ibatis.annotations.Param;
 
import com.yeshi.fanli.entity.bus.user.HongBao;
 
public interface HongBaoMapper {
 
    int deleteByPrimaryKey(Long id);
 
    int insert(HongBao record);
 
    int insertSelective(HongBao record);
 
    HongBao selectByPrimaryKey(Long id);
 
    HongBao selectByPrimaryKeyForUpdate(Long id);
 
    List<HongBao> selectByOrderId(String orderId);
 
    /**
     * 获取由该订单号所产生的红包(排除子红包)
     * 
     * @param orderId
     * @return
     */
    List<HongBao> selectByOrderIdWithoutChild(String orderId);
 
    List<HongBao> findChildHongBaoList(Long id);
 
    List<HongBao> selectByOid(Long oid);
 
    List<HongBao> selectByOrderIdSortWithAucationIdAndPayMoney(String orderId);
 
    Long selectCanBalanceHongBaoCountByType(@Param("type") int type);
 
    List<HongBao> selectCanBalanceHongBaoByType(@Param("type") int type, @Param("count") int count);
 
    List<HongBao> selectCanBalanceHongBaoByTypeAndUid(@Param("type") int type, @Param("uid") long uid,
            @Param("count") int count);
 
    // 获取能够返利的子红包的主红包列表
    List<HongBao> selectCanBalanceHongBaoByChildHongBao(int count);
 
    // 获取邀请赚可返利的用户列表
    List<Long> selectUidCanBalanceHongBaoByChildHongBao();
 
    List<HongBao> selectCanBalanceHongBaoByChildHongBaoAndUid(Long uid);
 
    /**
     * 通过主红包ID获取子红包列表
     * 
     * @param pid
     * @return
     */
    List<HongBao> selectChildHongBaoByPid(Long pid);
 
    int updateByPrimaryKeySelective(HongBao record);
 
    int updateByPrimaryKey(HongBao record);
 
    /**
     * 获取产生多个红包的订单号
     * 
     * @return
     */
    List<String> selectMultiHongBaoOrder();
 
    List<HongBao> selectByUid(Long uid);
 
    /**
     * 根据用户ID和类型查找红包
     * 
     * @param uid
     * @param type
     * @return
     */
    List<HongBao> selectByUidAndType(@Param("uid") Long uid, @Param("type") int type);
 
    // 累计提成订单数量(包含无效订单)
    int getTotalTiChengCount(Long uid);
 
    // 累计提成
    BigDecimal getTotalTiChengMoney(Long uid);
 
    // 未到账提成
    BigDecimal getUnGetTiChengMoney(Long uid);
 
    /**
     * 获取用户在时间段内的所有订单数量
     * 
     * @param uid
     * @param createtime
     * @return
     */
    Long getCountOrder(@Param("uid") Long uid, @Param("createtime") Long createtime);
 
    /**
     * 获取用户在时间段内维权订单数量
     * 
     * @param uid
     * @param createtime
     * @return
     */
    Long getCountCancelOrder(@Param("uid") Long uid, @Param("createtime") Long createtime);
 
    /**
     * 查询用户所有收入记录
     * 
     * @param start
     * @param count
     * @param uid
     * @return
     */
    List<HongBao> selectOrderByUid(@Param("start") int start, @Param("count") int count, @Param("uid") Long uid,
            @Param("startTime") String startTime, @Param("endTime") String endTime);
 
    int countOrderByUid(@Param("uid") Long uid, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
    /**
     * 统计收益
     * 
     * @param uid
     * @param startTime
     * @param endTime
     * @return
     */
    double countProfitByUid(@Param("uid") Long uid, @Param("startTime") String startTime,
            @Param("endTime") String endTime);
 
    /**
     * 统计记录总数
     * 
     * @param uid
     * @return
     */
    int getCountByUid(@Param("uid") Long uid);
 
    /**
     * 统计已经到账的订单数量
     * 
     * @param uid
     * @param state
     * @return
     */
    int getCountByUidAndState(@Param("uid") Long uid, @Param("state") int state);
 
    /**
     * 统计记录 失效订单数
     * 
     * @param uid
     * @return
     */
    int getCountCancelByUid(@Param("uid") Long uid);
 
    /**
     * 统计记录订单总数
     * 
     * @param uid
     * @return
     */
    Long getCountByUidOrder(@Param("uid") Long uid);
 
    /**
     * 统计已领取金额 账户历史总收益
     * 
     * @param uid
     * @return
     */
    double countReceiveMoneysByUid(@Param("uid") Long uid);
 
    /**
     * 统计未领取金额 待入账收益
     * 
     * @param uid
     * @return
     */
    double countForecastMoneysByUid(@Param("uid") Long uid);
 
    /**
     * 查询用户所有收入记录
     * 
     * @param start
     * @param count
     * @param uid
     * @return
     */
    List<HongBao> queryOrderByHB(@Param("start") int start, @Param("count") int count, @Param("key") String key,
            @Param("interval") Integer interval, @Param("startTime") String startTime, @Param("endTime") String endTime,
            @Param("orderType") Integer orderType);
 
    int countQueryOrderByHB(@Param("uid") Long uid, @Param("startTime") String startTime,
            @Param("endTime") String endTime);
 
    /**
     * 根据金额、订单号查询
     * 
     * @param oid
     * @param payMoney
     * @return
     */
    List<HongBao> queryByOrderIDAndPayMoney(@Param("oid") Long oid, @Param("payMoney") BigDecimal payMoney);
 
    /**
     * 根据用户、订单号查询
     * 
     * @param oid
     * @param uid
     * @return
     */
    List<HongBao> queryByOrderIDAndUid(@Param("oid") Long oid, @Param("uid") Long uid);
 
    /**
     * 统计当前用户 的自购订单数量
     * 
     * @param uid
     * @param isToday
     *            统计当天 1 统计今日条件生效
     * @param isMonth
     *            统计当月 1 统计当月条件生效 注意:不可与当日同时生效
     * @return
     */
    long countByUidSelf(@Param("uid") Long uid, @Param("isToday") Integer isToday, @Param("isMonth") Integer isMonth);
 
    /**
     * 最近一次下单时间
     * 
     * @param uid
     * @return
     */
    Long getLastOrderTime(Long uid);
 
    /**
     * 通过ID或者PID查询红包
     * 
     * @param id
     * @return
     */
    List<HongBao> selectByIdOrPid(Long id);
 
    /**
     * 查询前3天返利金额总额最高值
     * 
     * @return
     */
    Double getMaxMoney(@Param("typeArray") Integer typeArray[]);
 
    List<HongBao> listShareAndInviteMoney(@Param("start") long start, @Param("count") int count,
            @Param("date") String date);
 
    /**
     * 统计用户红包数量
     * @param uid
     * @param type
     * @param state
     * @param minTime
     * @param maxTime
     * @return
     */
    long selectCountByTypeAndStateAndCreateTime(@Param("uid") Long uid, @Param("type") List<Integer> type,
            @Param("state") List<Integer> state, @Param("minTime") Date minTime, @Param("maxTime") Date maxTime);
 
}