|
@@ -361,42 +361,48 @@ public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI
|
|
|
@PassToken
|
|
@PassToken
|
|
|
@Override
|
|
@Override
|
|
|
public CommonResult queryUserAuthor(String userId){
|
|
public CommonResult queryUserAuthor(String userId){
|
|
|
|
|
+ String[] userids = userId.split(",");
|
|
|
QueryWrapper<SmartAuthority> queryWrapper1 = new QueryWrapper<>();
|
|
QueryWrapper<SmartAuthority> queryWrapper1 = new QueryWrapper<>();
|
|
|
queryWrapper1.eq("deleted", 0);
|
|
queryWrapper1.eq("deleted", 0);
|
|
|
- queryWrapper1.eq("user_id", userId);
|
|
|
|
|
|
|
+ queryWrapper1.in("user_id", Arrays.asList(userids));
|
|
|
List<SmartAuthority> userAuthor = smartAuthorityService.getAuthorByKey(queryWrapper1);
|
|
List<SmartAuthority> userAuthor = smartAuthorityService.getAuthorByKey(queryWrapper1);
|
|
|
if (userAuthor.size()<=0){
|
|
if (userAuthor.size()<=0){
|
|
|
return CommonResult.ok(new ArrayList<>());
|
|
return CommonResult.ok(new ArrayList<>());
|
|
|
}
|
|
}
|
|
|
- SmartAuthority smartAuthority = userAuthor.get(0);
|
|
|
|
|
- Integer groupId = smartAuthority.getGroupId();
|
|
|
|
|
- SmartAuthorGroup smartAuthorGroup = smartAuthorGroupService.getSmartById(groupId);
|
|
|
|
|
- if (smartAuthorGroup==null){
|
|
|
|
|
- return CommonResult.ok(new ArrayList<>());
|
|
|
|
|
- }
|
|
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
|
|
- 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){
|
|
|
|
|
- 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);
|
|
|
|
|
|
|
+ List<JSONObject> allList = new ArrayList<>();
|
|
|
|
|
+ for (int i = 0; i < userAuthor.size(); i++) {
|
|
|
|
|
+ SmartAuthority smartAuthority = userAuthor.get(i);
|
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
|
+ jsonObject.put("userId", smartAuthority.getUserId());
|
|
|
|
|
+ Integer groupId = smartAuthority.getGroupId();
|
|
|
|
|
+ SmartAuthorGroup smartAuthorGroup = smartAuthorGroupService.getSmartById(groupId);
|
|
|
|
|
+ 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!=null && smartAuthorGroup.getDeleted()==0){
|
|
|
|
|
+ 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);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ jsonObject.put("treAuthor", new ArrayList<>());
|
|
|
|
|
+ }
|
|
|
|
|
+ allList.add(jsonObject);
|
|
|
}
|
|
}
|
|
|
- return CommonResult.ok(jsonObject);
|
|
|
|
|
|
|
+ return CommonResult.ok(allList);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 查看权限列表
|
|
* 查看权限列表
|
|
|
* @return
|
|
* @return
|