CustomerMapper.java
9.54 KB
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
package cn.com.glsx.entmicro.mapper;
import cn.com.glsx.entmicro.entity.Customer;
import cn.com.glsx.entmicro.model.CustomerMagicRopResponse;
import cn.com.glsx.entmicro.model.request.CustListSearchRequest;
import cn.com.glsx.entmicro.model.request.CustomerMergeRequest;
import cn.com.glsx.entmicro.model.request.CustomerStandardRequest;
import cn.com.glsx.entmicro.model.response.*;
import cn.com.glsx.entmicro.model.response.customer.CustomerFollowRpcResponse;
import com.github.pagehelper.Page;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Mapper
public interface CustomerMapper extends CommonBaseMapper<Customer> {
List<StaffFollowResponse> getStaffFollowById(Integer id);
List<StaffFollowResponse> getStaffFollowByOneId(@Param("oneId")String oneId,@Param("merchantId") Integer merchantId);
@MapKey("id")
Map<Integer, BelongCustomerBaseResponse> getCustomerBaseByOneId(@Param("oneId")String oneId,@Param("merchantId") Integer merchantId);
@MapKey("groupId")
Map<Integer, CustomerBaseCountResponse> countCustomerBase(@Param("ids") Set<Integer> ids);
/**
* userId 查客户
*
* @param userid
* @return
*/
Customer getCustomerByUserId(String userid);
int updateOneIdByCust(@Param("oneId") String oneId, @Param("custId") Integer custId);
int changeOneId(@Param("newOneId") String newOneId,@Param("ids") List<Integer> id);
void deleteaById(Integer id);
List<CustomerStandardRequest> findAllCustomerByMerchantId(@Param("merchantId")int merchantId,@Param("userIds") List<String> userIds);
/**
* 批量userId查客户
* @param userid
* @return
*/
@MapKey("userid")
Map<String, Customer> getCustomersByUserId(@Param("ids") List<String> userid);
CustomerInfo getCustomerById(@Param("custId") Integer custId,@Param("staffId")Integer staffId);
/**
* oneId批量查跟进员工
*
* @param oneIds
* @return
*/
@MapKey("oneId")
Map<String, CustomerFollowStaffResponse> getCustomerStaffByOneId(@Param("oneIds") List<String> oneIds,@Param("merchantId") Integer merchantId);
/**
* oneId批量查跟进员工
*
* @param oneIds
* @return
*/
@MapKey("oneId")
Map<String, CustomerFollowStaffResponse> getAllCustomerStaffByOneId(@Param("oneIds") List<String> oneIds,@Param("merchantId") Integer merchantId);
/**
* oneId批量查跟进员工(List)
*
* @param oneIdList
* @return
*/
List<CustomerFollowStaffResponse> getListCustomerStaffByOneId(@Param("merchantIdList") List<Integer> merchantIdList,
@Param("oneIdList") List<String> oneIdList,@Param("staffIdList") List<Integer> staffIdList);
int getCustomerByOneId(@Param("oneId")String oneId, @Param("merchantId") Integer merchantId);
/**
* 通过企业员工查询所有客户信息
*
* @param userIdList
* @return
*/
List<CustomerInfo> getCustomerInfoByUserId(@Param("userIdList") List<String> userIdList, @Param("sex") Byte sex,
@Param("start") Date start, @Param("end") Date end);
List<CustomerInfoResponse> findCustomerByStaffId(@Param("staffId") Integer integer, @Param("keyword") String keyword, @Param("isMiniPro") Boolean isMiniPro);
List<CustomerInfoResponse> findCustomerBychantIds(@Param("custSearchRequest") CustListSearchRequest custSearchRequest);
List<CustomerInfoResponse> findCustomerByStaffIds(@Param("custSearchRequest") CustListSearchRequest custSearchRequest);
List<Customer> findCustomerByPhones(@Param("phones") List<String> phones, @Param("merchantId") Integer merchantId);
List<CustomerInfoResponse> findNoAddEntmocroCustByMerchant(@Param("merchantId") Integer merchantId);
List<CustomerInfoResponse> findNoPhoneCustByMerchant(@Param("merchantId") Integer merchantId);
int findNoAddEntmocroCustByMerchantCount(@Param("merchantId") Integer merchantId);
int findNoPhoneCustByMerchantCount(@Param("merchantId") Integer merchantId);
List<CustomerInfoResponse> findWaitRenewal(@Param("merchantId") Integer merchantId);
List<CustomerInfoResponse> findWaitRegularMaintain(@Param("merchantId") Integer merchantId);
Integer findWaitRenewalCount(@Param("merchantId") Integer merchantId);
int findWaitRegularMaintainCount(@Param("merchantId") Integer merchantId);
List<CustomerInfoResponse> findMagicCust(@Param("merchantId") Integer merchantId);
/**
* 查询魔方客户数
* @param merchantId
* @param status
* @return
*/
int findMagicCustCount(@Param("merchantId") Integer merchantId,
@Param("status") Integer status);
Customer findPhoneAndMerchantId(@Param("customerPhone") String customerPhone, @Param("merchantid")List<Integer> merchantid);
int batchUpdateOneId(@Param("customers")List<CustomerMagicRopResponse> customers);
int batchUpdate(@Param("customers")List<Customer> customers);
int batchInsert(@Param("customers")List<Customer> customers);
/**
* 查询客户是否是企微客户
*
* @param phone 手机号码
* @return
*/
List<Customer> isEntmicroCustomer(@Param("phone") String phone, @Param("merchantId") Integer merchantId);
Page<String> selectAllOneId();
/**
* 批量oneId查客户,过滤没加员工好友的信息
*
* @param oneIdList
* @param merchantId
* @return
*/
List<CustomerNickNameRpcResponse> findByBatchOneId(@Param("oneIdList")List<String> oneIdList,
@Param("merchantId")Integer merchantId);
List<CustomerInfoResponse> findCustomerBymergeIds(@Param("mergeIds") List<Integer> mergeIds, @Param("phone") String phone, @Param("merchantId") Integer merchantId, @Param("customerName") String customerName);
/**
* 批量补充手机号
*/
int updatePhoneByUserId(@Param("customer")List<Customer> customer);
void insertinto(@Param("sql") String toString);
/**
* 根据手机号和来源渠道查询客户列表
*
* @param phoneList
* @param merchantId
* @param addWay
* @return
*/
List<Customer> selectCustomerNameByPhone(@Param("phoneList") List<String> phoneList,@Param("merchantId") Integer merchantId,@Param("addWay") String addWay);
Customer getNotEntmicroCustomerByOneId(@Param("customerMergeRequest")CustomerMergeRequest customerMergeRequest);
List<CustGroupResponse> filterCustomerChatIdsByStaffIds(@Param("merchantId") Integer merchantId,@Param("staffIds")List<Integer> staffIds);
List<CustomerInfoResponse> findCusetomerListByMergeIds(@Param("mergeIds")List<Integer> mergeIds,
@Param("merchantId") Integer merchantId,
@Param("staffId") Integer staffId);
//根据客户表id列表查询客户合并表id列表
List<Integer> getMergeIdList(@Param("customerIds") List<Integer> customerIds, @Param("merchantId")Integer merchantId);
List<Integer> findCustomerByOneId(@Param("oldOneId") String oldOneId, @Param("merchantId")Integer merchantId);
List<String> queryOneIdByPhoneNumber(@Param("phone")String phone, @Param("merchantId")Integer merchantId);
/**
* 查询门店下的企微客户
* @param merhcantId
* @return
*/
List<Customer> selectCustomerByMerchant(Integer merhcantId);
void updateCustomerMergeSubscribe(@Param("appId") String appId, @Param("merchantId") Integer merchantId);
List<String> selectUseridByUnionIdIsNull(@Param("merchantId")Integer merchantId);
/**
* userId批量查跟进员工
*
* @param userIdList
* @return
*/
@MapKey("customerUserId")
Map<String, CustomerFollowStaffResponse> getCustomerStaffByUserId(@Param("userIdList") List<String> userIdList);
List<StaffFollowResponse> selectFollowStaffByCustomerPhone(@Param("merchantId")Integer merchantId, @Param("customerPhone")String customerPhone,
@Param("staffIdList")List<Integer> staffIdList,@Param("userIdList") List<String> userIdList);
/**
* 客户主键查跟进人关联
* @param id
* @return
*/
List<Integer> getStaffByCustomerId(@Param("id")Integer id);
/**
* unionId查客户
* @param unionIdList
* @return
*/
List<String> selectUseridByUnionId(@Param("unionIdList") List<String> unionIdList);
/**
* 批量oneId获取跟进人关联
* @param oneIdList
* @param merchantId
* @return
*/
List<CustomerFollowRpcResponse> getCustomerFollowByOneIdList(@Param("oneIdList")List<String> oneIdList,
@Param("merchantId")Integer merchantId);
List<CustomerInfoResponse> findAddEntmicroCustomerByPhones(@Param("merchantId") Integer merchantId,@Param("phoneList") List<String> phoneList);
CustomerInfoResponse findCustomerByUserIdOrOneId(@Param("id") String id, @Param("merchantId") Integer merchantId);
List<CustomerInfoResponse> findCustomerByOneidList(@Param("oneIdList")List<String> oneIdList,
@Param("merchantId")Integer merchantId);
List<String> findUserIdByCustomerId(@Param("customerIds")List<Integer> customerIds);
}