|
|
@@ -64,18 +64,22 @@ public class FsCompanyCustomerController extends BaseController {
|
|
|
*/
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(FsCompanyCustomer fsCompanyCustomer) {
|
|
|
-// LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
-// fsCompanyCustomer.setCompanyUserId(loginUser.getUser().getUserId());
|
|
|
-// //管理员查看所有数据
|
|
|
+ // 获取当前登录用户id
|
|
|
+ Long currentUserId = SecurityUtils.getLoginUser().getUser().getUserId();
|
|
|
+ //管理员
|
|
|
// Long isAdmin = roleMapper.companyUserIsAdmin(fsCompanyCustomer.getCompanyUserId());
|
|
|
-// if (isAdmin != null) {
|
|
|
-// fsCompanyCustomer.setCompanyUserId(null);
|
|
|
-// }
|
|
|
PageHelper.startPage(fsCompanyCustomer.getPageNum(), fsCompanyCustomer.getPageSize());
|
|
|
List<FsCompanyCustomer> list = fsCompanyCustomerService.selectFsCompanyCustomerList(fsCompanyCustomer);
|
|
|
// 遍历集合,对每个对象的 phone 属性进行脱敏赋值
|
|
|
list.forEach(customer -> {
|
|
|
+ // 如果销售 ID 等于当前用户 ID,就是自己的客户
|
|
|
+ customer.setMyCustomerFlag(
|
|
|
+ customer.getCompanyUserId() != null && customer.getCompanyUserId().equals(currentUserId)
|
|
|
+ );
|
|
|
customer.setPhone(maskPhoneMiddleFive(customer.getPhone()));
|
|
|
+// if (isAdmin != null) {
|
|
|
+// customer.setMyCustomerFlag(true); // 如果是管理员全部为自己的客户
|
|
|
+// }
|
|
|
});
|
|
|
return getDataTable(list);
|
|
|
}
|