From c6f579b1265dc4809833578a5103d72359099f27 Mon Sep 17 00:00:00 2001 From: Zheng Jie <201507802@qq.com> Date: Fri, 7 Jul 2023 10:41:03 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/me/zhengjie/config/RedisConfig.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java b/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java index 95217a26..d36a0be7 100644 --- a/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java +++ b/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java @@ -127,6 +127,7 @@ public class RedisConfig extends CachingConfigurerSupport { @Bean @Override + @SuppressWarnings({"all"}) public CacheErrorHandler errorHandler() { // 异常处理,当Redis发生异常时,打印日志,但是程序正常走 log.info("初始化 -> [{}]", "Redis CacheErrorHandler"); @@ -152,7 +153,6 @@ public class RedisConfig extends CachingConfigurerSupport { } }; } - } /** @@ -161,7 +161,7 @@ public class RedisConfig extends CachingConfigurerSupport { * @author / * @param */ - class FastJsonRedisSerializer implements RedisSerializer { +class FastJsonRedisSerializer implements RedisSerializer { private final Class clazz; @@ -180,7 +180,7 @@ public class RedisConfig extends CachingConfigurerSupport { @Override public T deserialize(byte[] bytes) { - if (bytes == null || bytes.length <= 0) { + if (bytes == null || bytes.length == 0) { return null; } String str = new String(bytes, StandardCharsets.UTF_8); From 3aab1567c42a3e53d58e02d25e63184de5b907cc Mon Sep 17 00:00:00 2001 From: Zheng Jie <201507802@qq.com> Date: Fri, 7 Jul 2023 11:06:44 +0800 Subject: [PATCH 2/3] update README.md --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index 30af5b9f..798ee741 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,6 @@ | github | https://github.com/elunez/eladmin | https://github.com/elunez/eladmin-web | | 码云 | https://gitee.com/elunez/eladmin | https://gitee.com/elunez/eladmin-web | -#### 赞助商 | Sponsor - - -明道云零代码构建平台 - - #### 主要特性 - 使用最新技术栈,社区资源丰富。 - 高效率开发,代码生成器可一键生成前后端代码 From 484785c22201802bb0a37ae5f872325903c4acb6 Mon Sep 17 00:00:00 2001 From: Zheng Jie <201507802@qq.com> Date: Fri, 7 Jul 2023 17:34:57 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=E3=80=90=E8=8F=9C=E5=8D=95=E3=80=81?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E3=80=91=E7=A7=BB=E5=8A=A8=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E6=97=B6=E5=87=BA=E7=8E=B0PID=E6=95=B0=E6=8D=AE=E7=8E=AF?= =?UTF-8?q?=E5=BD=A2=E9=97=AE=E9=A2=98=20close=20https://github.com/elunez?= =?UTF-8?q?/eladmin/issues/803?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zhengjie/modules/system/rest/DeptController.java | 8 ++++++++ .../zhengjie/modules/system/rest/MenuController.java | 12 ++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java index 39d96934..f12a4a2e 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java @@ -34,6 +34,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.*; +import java.util.stream.Collectors; /** * @author Zheng Jie @@ -71,8 +72,15 @@ public class DeptController { for (Long id : ids) { DeptDto deptDto = deptService.findById(id); List depts = deptService.getSuperior(deptDto, new ArrayList<>()); + for (DeptDto dept : depts) { + if(dept.getId().equals(deptDto.getPid())) { + dept.setSubCount(dept.getSubCount() - 1); + } + } deptSet.addAll(depts); } + // 编辑部门时不显示自己以及自己下级的数据,避免出现PID数据环形问题 + deptSet = deptSet.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toSet()); return new ResponseEntity<>(deptService.buildTree(new ArrayList<>(deptSet)),HttpStatus.OK); } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java index 4ad3695b..18084f16 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java @@ -24,6 +24,7 @@ import me.zhengjie.modules.system.domain.Menu; import me.zhengjie.exception.BadRequestException; import me.zhengjie.modules.system.domain.vo.MenuVo; import me.zhengjie.modules.system.service.MenuService; +import me.zhengjie.modules.system.service.dto.DeptDto; import me.zhengjie.modules.system.service.dto.MenuDto; import me.zhengjie.modules.system.service.dto.MenuQueryCriteria; import me.zhengjie.modules.system.service.mapstruct.MenuMapper; @@ -43,7 +44,6 @@ import java.util.stream.Collectors; * @author Zheng Jie * @date 2018-12-03 */ - @RestController @RequiredArgsConstructor @Api(tags = "系统:菜单管理") @@ -104,8 +104,16 @@ public class MenuController { if(CollectionUtil.isNotEmpty(ids)){ for (Long id : ids) { MenuDto menuDto = menuService.findById(id); - menuDtos.addAll(menuService.getSuperior(menuDto, new ArrayList<>())); + List menuDtoList = menuService.getSuperior(menuDto, new ArrayList<>()); + for (MenuDto menu : menuDtoList) { + if(menu.getId().equals(menuDto.getPid())) { + menu.setSubCount(menu.getSubCount() - 1); + } + } + menuDtos.addAll(menuDtoList); } + // 编辑菜单时不显示自己以及自己下级的数据,避免出现PID数据环形问题 + menuDtos = menuDtos.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toSet()); return new ResponseEntity<>(menuService.buildTree(new ArrayList<>(menuDtos)),HttpStatus.OK); } return new ResponseEntity<>(menuService.getMenus(null),HttpStatus.OK);