Browse Source

订单及权限修改

zhuhao 2 years ago
parent
commit
1682eb3711

+ 12 - 19
imcs-bt-be/imcs-authority-biz/src/main/java/com/github/zuihou/authority/service/auth/impl/RoleAuthorityServiceImpl.java

@@ -75,26 +75,7 @@ public class RoleAuthorityServiceImpl extends SuperServiceImpl<RoleAuthorityMapp
         super.remove(Wraps.<RoleAuthority>lbQ().eq(RoleAuthority::getRoleId, dto.getRoleId()));
 
         List<RoleAuthority> list = new ArrayList<>();
-        //if (dto.getResourceIdList() != null && !dto.getResourceIdList().isEmpty()) {
-        if (!CollectionUtils.isEmpty(dto.getResourceIdList())) {
-//            List<Long> menuIdList = resourceService.findMenuIdByResourceId(dto.getResourceIdList());
-//            if (dto.getMenuIdList() == null || dto.getMenuIdList().isEmpty()) {
-//                dto.setMenuIdList(menuIdList);
-//            } else {
-//                dto.getMenuIdList().addAll(menuIdList);
-//            }
 
-            //保存授予的资源
-            List<RoleAuthority> resourceList = new HashSet<>(dto.getResourceIdList())
-                    .stream()
-                    .map((resourceId) -> RoleAuthority.builder()
-                            .authorityType(AuthorizeType.RESOURCE)
-                            .authorityId(resourceId)
-                            .roleId(dto.getRoleId())
-                            .build())
-                    .collect(Collectors.toList());
-            list.addAll(resourceList);
-        }
         if (!CollectionUtils.isEmpty(dto.getMenuIdList())) {
             //保存授予的菜单
             List<RoleAuthority> menuList = new HashSet<>(dto.getMenuIdList())
@@ -106,6 +87,18 @@ public class RoleAuthorityServiceImpl extends SuperServiceImpl<RoleAuthorityMapp
                             .build())
                     .collect(Collectors.toList());
             list.addAll(menuList);
+            if (!CollectionUtils.isEmpty(dto.getResourceIdList())) {
+                //保存授予的资源
+                List<RoleAuthority> resourceList = new HashSet<>(dto.getResourceIdList())
+                        .stream()
+                        .map((resourceId) -> RoleAuthority.builder()
+                                .authorityType(AuthorizeType.RESOURCE)
+                                .authorityId(resourceId)
+                                .roleId(dto.getRoleId())
+                                .build())
+                        .collect(Collectors.toList());
+                list.addAll(resourceList);
+            }
         }
         super.saveBatch(list);