yujian
2020-05-06 eb1adc13eda955e8ef0fc9fe41fb246fa89b722d
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
package com.yeshi.fanli.dao.mybatis;
 
import java.util.List;
 
import org.apache.ibatis.annotations.Param;
 
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserInfo;
 
public interface ThreeSaleMapper {
 
    int deleteByPrimaryKey(Long id);
 
    int insert(ThreeSale record);
 
    int insertSelective(ThreeSale record);
 
    int updateByPrimaryKey(ThreeSale record);
    
    int updateByPrimaryKeySelective(ThreeSale record);
 
    ThreeSale selectByPrimaryKey(Long id);
    
    
    UserInfo selectBoss(Long uid);
    
    /**
     * 根据被邀请者ID查询
     * 
     * @param workerId
     * @return
     */
    ThreeSale getByWorkerId(Long workerId);
    
 
    /**
     * 
     * @param uid
     * @return
     */
    ThreeSale getMyBoss(@Param("uid") Long uid);
    
 
    /**
     * 根据下级查询成功的邀请关系
     * @param workerId
     * @return
     */
    ThreeSale selectSuccessByWorkerId(Long workerId);
 
    
    /**
     * 根据邀请者ID查询关系
     * 
     * @param workerId
     * @return
     */
    List<ThreeSale> listByWorkerId(Long workerId);
    
    
 
    /**
     * 一级查询-后台查询
     * 
     * @param start
     * @param count
     * @param key
     * @param startTime
     * @param endTime
     * @return
     */
    List<ThreeSale> listFirstTeamQuery(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid,
            @Param("state") Integer state, @Param("startTime") String startTime, @Param("endTime") String endTime,
            @Param("validState") Integer validState);
 
    long countFirstTeamQuery(@Param("uid") Long uid, @Param("state") Integer state, @Param("startTime") String startTime,
            @Param("endTime") String endTime, @Param("validState") Integer validState);
 
    /**
     * 二级查询 -后台查询
     * 
     * @param start
     * @param count
     * @param key
     * @param startTime
     * @param endTime
     * @return
     */
    List<ThreeSale> listSecondTeamQuery(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid,
            @Param("state") Integer state, @Param("startTime") String startTime, @Param("endTime") String endTime
            ,@Param("validState") Integer validState);
 
    long countSecondTeamQuery(@Param("uid") Long uid, @Param("state") Integer state,
            @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("validState") Integer validState);
 
    /**
     * 上级查询 -后台查询
     * 
     * @param start
     * @param count
     * @param uid
     * @return
     */
    List<ThreeSale> listSuperiorQuery(@Param("start") long start, @Param("count") int count,
            @Param("state") Integer state, @Param("uid") Long uid);
 
    long countSuperiorQuery(@Param("state") Integer state, @Param("uid") Long uid);
 
    
    
    /**
     * 查询一级队员
     * @param start
     * @param count
     * @param uid
     * @return
     */
    List<ThreeSale> listFirstTeam(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid,
            @Param("listId")List<Long> listId);
 
    /**
     * 查询二级队员
     * @param start
     * @param count
     * @param uid
     * @return
     */
    List<ThreeSale> listSecondTeam(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid,
            @Param("listId")List<Long> listId);
    
    /**
     * 统计一级队员
     * @param uid
     * @return
     */
    long countFirstTeam(@Param("uid") Long uid, @Param("listId")List<Long> listId);
    
    /**
     * 统计二级队员
     * @param uid
     * @return
     */
    long countSecondTeam(@Param("uid") Long uid, @Param("listId")List<Long> listId);
 
 
    /**
     * 根据id、uid查询
     * 
     * @param id
     * @param uid
     * @return
     */
    List<ThreeSale> listbyIdAndBossId(@Param("id") Long id, @Param("uid") Long uid, @Param("expire") Integer expire);
 
    
    /**
     * 获取成功邀请关系数量
     * 
     * @param uid
     * @return
     */
    int getSuccessRelationshipNum(@Param("uid") Long uid);
    
    
    /**
     * 根据邀请者ID、bossID查询 有效关系
     * 
     * @param workerId
     * @return
     */
    ThreeSale getRelationshipByBossIdAndWorkerId(@Param("bossId") Long bossId, @Param("workerId") Long workerId);
    
    
    /**
     * 最后一次关系记录 -无论
     * @param bossId
     * @param workerId
     * @return
     */
    ThreeSale getNearRelationByBossIdAndWorkerId(@Param("bossId") Long bossId, @Param("workerId") Long workerId);
    
    
    
    /**
     * 查询时间段邀请成功人信息
     * @param bossId
     * @param minTime
     * @param maxTime
     * @return
     */
    List<ThreeSale> getSuccessByDate(@Param("bossId")Long bossId,@Param("minTime")Long minTime, @Param("maxTime")Long maxTime);
    
    /**
     * 查询最近的信息(根据下级ID与状态)
     * @param workerId
     * @param state
     * @return
     */
    ThreeSale selectLatestByWorkerIdAndState(@Param("workerId") Long workerId,@Param("state") int state);
    
    /**
     * 根据时间查询邀请关系
     * @param uid
     * @param time
     * @return
     */
    ThreeSale getByWorkerIdAndTime(@Param("workerId") Long workerId, @Param("time") long time);
    
    /**
     * 邀请关系脱离
     * @param bossId
     * @param workerId
     */
    void inviteSeparate(@Param("workerId") Long workerId, @Param("bossId")Long bossId);
    
    /**
     * 队员在该boss 下第几个队员序号
     * @param workerId
     * @return
     */
    long getTeamOrderNumByWorkerId(@Param("workerId") Long workerId);
    
    /**
     * 有效粉丝uid
     * @param bossId
     * @param limitTime
     * @return
     */
    List<ThreeSale> getValidWorkerIdsByTime(@Param("uid") Long uid,@Param("limitTime") long limitTime);
    
    
}