From d68ce219263d584b9fa1b172ad1131837a10a3c7 Mon Sep 17 00:00:00 2001 From: Guo XIn <371864209@qq.com> Date: Mon, 21 Aug 2023 11:29:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=B0=86=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E7=9A=84=E5=AD=90=E7=BA=A7=E7=9B=AE=E5=BD=95=E6=9D=83?= =?UTF-8?q?=E9=99=90=E8=B5=8B=E4=BA=88=E6=99=AE=E9=80=9A=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E6=99=AE=E9=80=9A=E7=94=A8=E6=88=B7=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=9F=A5=E7=9C=8B=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bianmu/service/DirectoryTreeService.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/shandan-system/src/main/java/com/keyware/shandan/bianmu/service/DirectoryTreeService.java b/shandan-system/src/main/java/com/keyware/shandan/bianmu/service/DirectoryTreeService.java index bafaef7..0049fa3 100644 --- a/shandan-system/src/main/java/com/keyware/shandan/bianmu/service/DirectoryTreeService.java +++ b/shandan-system/src/main/java/com/keyware/shandan/bianmu/service/DirectoryTreeService.java @@ -63,15 +63,18 @@ public class DirectoryTreeService { Set permisDis = "write".equals(permis) ? dirPermissionService.getByWritePermis(user) : dirPermissionService.getByReadPermis(user); // 判断权限范围 List permisDirectoryList = StreamUtil.as(directoryList).filter(dir -> { - if(dir.getReviewStatus() == status || status == null){ + if (dir.getReviewStatus() == status || status == null) { boolean permisAllow = permisDis.contains(dir.getId()); - if(permisAllow){ + if (permisAllow) { return true; } // 如果权限不允许,则需要判断当前节点的所有子级节点是否有允许的目录,如果有则需要返回到前端的树组件中 - Set childrenIds = getDirectoryList(dir, true, false, busType).stream().map(DirectoryVo::getId).collect(Collectors.toSet()); - for(String id : childrenIds){ - if(permisDis.contains(id)){ + Set childrenIds = getDirectoryList(dir, true, false, busType) + .stream() + .map(DirectoryVo::getId) + .collect(Collectors.toSet()); + for (String id : childrenIds) { + if (permisDis.contains(id)) { return true; } } @@ -103,9 +106,9 @@ public class DirectoryTreeService { */ private List getDirectoryList(DirectoryVo parentDir, boolean allChild, boolean hasResource, int busType) { QueryWrapper wrapper = new QueryWrapper<>(); - if(parentDir == null){ + if (parentDir == null) { wrapper.eq("ID", "ROOT"); - }else { + } else { wrapper.in(!hasResource, "DIRECTORY_TYPE", DirectoryType.DIRECTORY, DirectoryType.LINK_DIR).eq("IS_BASIC_DIR", busType); if (parentDir != null) { if (allChild) {