FengChaoYu 5 meses atrás
pai
commit
66b4072780

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

@@ -617,31 +617,33 @@ public class AdminUserLogic {
                 .orderByAsc(AdminUser::getCreateTime)
                 .page(new Page<>(pageNum, pageSize));
 
-        for (AdminUser record : page.getRecords()) {
-            AdminUserWebsitRela adminUserWebsitRela = adminUserWebsitRelaService.lambdaQuery()
-                    .eq(AdminUserWebsitRela::getAdminUserId, record.getAdminUserId())
-                    .last("limit 1")
-                    .one();
+        if (CollectionUtil.isNotEmpty(page.getRecords())) {
+            for (AdminUser record : page.getRecords()) {
+                AdminUserWebsitRela adminUserWebsitRela = adminUserWebsitRelaService.lambdaQuery()
+                        .eq(AdminUserWebsitRela::getAdminUserId, record.getAdminUserId())
+                        .last("limit 1")
+                        .one();
 
-            AdminUserDeptRela adminUserDeptRela = adminUserDeptRelaService.lambdaQuery()
-                    .eq(AdminUserDeptRela::getAdminUserId, record.getAdminUserId())
-                    .last("limit 1")
-                    .one();
+                AdminUserDeptRela adminUserDeptRela = adminUserDeptRelaService.lambdaQuery()
+                        .eq(AdminUserDeptRela::getAdminUserId, record.getAdminUserId())
+                        .last("limit 1")
+                        .one();
 
-            if (adminUserDeptRela != null) {
+                if (adminUserDeptRela != null) {
 
-                AdminDept adminDept = adminDeptService.getById(adminUserDeptRela.getAdminDeptId());
+                    AdminDept adminDept = adminDeptService.getById(adminUserDeptRela.getAdminDeptId());
 
-                record.setDeptWebsitName(adminDept.getDeptName());
+                    record.setDeptWebsitName(adminDept.getDeptName());
 
-            } else if (adminUserWebsitRela != null) {
+                } else if (adminUserWebsitRela != null) {
 
-                AdminWebsit adminWebsit = adminWebsitService.getById(adminUserWebsitRela.getAdminWebsitId());
-                if (adminWebsit != null)
-                 record.setDeptWebsitName(adminWebsit.getName());
-            }
+                    AdminWebsit adminWebsit = adminWebsitService.getById(adminUserWebsitRela.getAdminWebsitId());
+                    if (adminWebsit != null)
+                        record.setDeptWebsitName(adminWebsit.getName());
+                }
 
 
+            }
         }