‘linchangsheng’ 5 months ago
parent
commit
7269c270a9

+ 2 - 1
mall-server-api/src/main/java/com/gree/mall/manager/controller/admin/AdminUserController.java

@@ -149,11 +149,12 @@ public class AdminUserController {
             @ApiParam(value = "角色id",required = false) @RequestParam(required = false) String roleId,
             @ApiParam(value = "状态 true:正常 false:冻结",required = false) @RequestParam(required = false) Boolean status,
             @ApiParam(value = "用户名",required = false) @RequestParam(required = false) String userName,
+            @ApiParam(value = "网点id",required = false) @RequestParam(required = false) String websitId,
             @ApiParam(value = "页号",required = true) @RequestParam(required = true) Integer pageNum,
             @ApiParam(value = "页大小",required = true) @RequestParam(required = true) Integer pageSize,
             HttpServletRequest request
     ) throws RemoteServiceException {
-        IPage<AdminUser> page = adminUserLogic.list(companyWechatId,companyWechatName,roleId,status,userName,pageNum, pageSize);
+        IPage<AdminUser> page = adminUserLogic.list(companyWechatId,companyWechatName,roleId,status,userName,pageNum, pageSize,websitId);
         return ResponseHelper.success(page);
     }
 

+ 18 - 1
mall-server-api/src/main/java/com/gree/mall/manager/logic/admin/AdminUserLogic.java

@@ -578,7 +578,7 @@ public class AdminUserLogic {
      *
      * @return
      */
-    public IPage<AdminUser> list(String companyWechatId, String companyWechatName, String roleId, Boolean status, String userName, Integer pageNum, Integer pageSize) {
+    public IPage<AdminUser> list(String companyWechatId, String companyWechatName, String roleId, Boolean status, String userName, Integer pageNum, Integer pageSize,String websitId) {
         AdminUserCom adminUser = commonLogic.getAdminUser();
 
         if (adminUser.getType() != 2) {
@@ -588,6 +588,23 @@ public class AdminUserLogic {
             // 网点主账号能看到账号
         }
 
+        List<String> adminUserIds = new ArrayList<>();
+        if (!StringUtil.isEmpty(websitId)) {
+            List<String> adminUserIdList = adminUserWebsitRelaService.lambdaQuery().eq(AdminUserWebsitRela::getAdminWebsitId, websitId).select(AdminUserWebsitRela::getAdminUserId)
+                    .list().stream().map(AdminUserWebsitRela::getAdminUserId).collect(Collectors.toList());
+            adminUserIds.addAll(adminUserIdList);
+
+            List<String> depts = adminDeptWebsitService.lambdaQuery().eq(AdminDeptWebsit::getWebsitId, websitId).select(AdminDeptWebsit::getAdminDeptId).list().stream()
+                    .map(AdminDeptWebsit::getAdminDeptId).collect(Collectors.toList());
+            List<String> userIds = adminUserDeptRelaService.lambdaQuery().in(AdminUserDeptRela::getAdminDeptId, depts).select(AdminUserDeptRela::getAdminUserId).list().stream()
+                    .map(AdminUserDeptRela::getAdminUserId).collect(Collectors.toList());
+            adminUserIds.addAll(userIds);
+
+            if (CollectionUtils.isEmpty(adminUserIdList))
+                return new Page<>();
+
+        }
+
         IPage<AdminUser> page = adminUserService.lambdaQuery()
                 .eq(StringUtils.isNotBlank(companyWechatId), AdminUser::getCompanyWechatId, companyWechatId)
                 .like(StringUtils.isNotBlank(companyWechatName), AdminUser::getCompanyName, companyWechatName)