Просмотр исходного кода

更新文件 SmartAuthorGroupController.java

陈士柏 2 лет назад
Родитель
Сommit
2f4496ff8b
1 измененных файлов с 25 добавлено и 10 удалено
  1. 25 10
      src/main/java/com/template/controller/SmartAuthorGroupController.java

+ 25 - 10
src/main/java/com/template/controller/SmartAuthorGroupController.java

@@ -8,17 +8,13 @@ import com.template.api.SmartAuthorGroupControllerAPI;
 import com.template.common.utils.TimeExchange2;
 import com.template.common.utils.TreeRecordsUtil;
 import com.template.common.utils.UUIDUtil;
-import com.template.model.pojo.SmartAuthorGroup;
-import com.template.model.pojo.SmartAuthority;
-import com.template.model.pojo.SmartUser;
+import com.template.model.pojo.*;
 import com.template.model.result.CommonResult;
 import com.template.model.weixin.AuthorAndGroup;
 import com.template.model.weixin.AuthorAndGroup2;
 import com.template.model.weixin.AuthorListGroup;
 import com.template.model.weixin.userAuthor;
-import com.template.services.SmartAuthorGroupService;
-import com.template.services.SmartAuthorityService;
-import com.template.services.SmartUserService;
+import com.template.services.*;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import org.springframework.web.bind.annotation.RestController;
@@ -44,6 +40,10 @@ public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI
     public SmartAuthorityService smartAuthorityService;
     @Autowired
     public SmartUserService smartUserService;
+    @Autowired
+    public SmartDepartmentService smartDepartmentService;
+    @Autowired
+    public SmartMenuService smartMenuService;
 
     /**
      * 新增权限组
@@ -375,10 +375,25 @@ public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI
             return CommonResult.ok(new ArrayList<>());
         }
         JSONObject jsonObject = new JSONObject();
-        jsonObject.put("departmentViewAuthor", smartAuthority.getDepartmentView());
-        jsonObject.put("departmentManageAuthor", smartAuthority.getDepartmentManage());
+        QueryWrapper<SmartDepartment> queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.eq("deleted", 0);
+        List<String> viewDepart = Arrays.asList(smartAuthority.getDepartmentView().split(","));
+        queryWrapper2.in("id", viewDepart);
+        List<SmartDepartment> list1 = smartDepartmentService.list(queryWrapper2);
+        QueryWrapper<SmartDepartment> queryWrapper3 = new QueryWrapper<>();
+        queryWrapper3.eq("deleted", 0);
+        List<String> manageDepart = Arrays.asList(smartAuthority.getDepartmentManage().split(","));
+        queryWrapper3.in("id", manageDepart);
+        List<SmartDepartment> list2 = smartDepartmentService.list(queryWrapper3);
+        jsonObject.put("departmentViewAuthor", list1);
+        jsonObject.put("departmentManageAuthor", list2);
         if (smartAuthorGroup.getDeleted()==0){
-            jsonObject.put("treAuthor", smartAuthorGroup.getApplyId());
+            QueryWrapper<SmartMenu> queryWrapper4 = new QueryWrapper<>();
+            queryWrapper4.eq("deleted", 0);
+            List<String> menuList = Arrays.asList(smartAuthorGroup.getApplyId().split(","));
+            queryWrapper4.in("id", menuList);
+            List<SmartMenu> list3 = smartMenuService.list(queryWrapper4);
+            jsonObject.put("treAuthor", list3);
         }
         return CommonResult.ok(jsonObject);
     }
@@ -392,7 +407,7 @@ public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI
         List<SmartAuthorGroup> smartAuthorGroups = smartAuthorGroupService.getAuthorGroupList();
         List<AuthorListGroup> authorListGroupList = null;
         if (smartAuthorGroups.size()>0) {
-            authorListGroupList = TreeRecordsUtil.queryCommentTreeRecords(authorGroupId, smartAuthorGroups);
+            authorListGroupList = smartAuthorGroupService.queryCommentTreeRecords(authorGroupId, smartAuthorGroups);
         }
         return CommonResult.ok(authorListGroupList);
     }