diff --git a/kernel-s-system/system-business-menu/src/main/java/cn/stylefeng/roses/kernel/system/modular/menu/factory/AntdMenusFactory.java b/kernel-s-system/system-business-menu/src/main/java/cn/stylefeng/roses/kernel/system/modular/menu/factory/AntdMenusFactory.java index 32086980d..00756a5d2 100644 --- a/kernel-s-system/system-business-menu/src/main/java/cn/stylefeng/roses/kernel/system/modular/menu/factory/AntdMenusFactory.java +++ b/kernel-s-system/system-business-menu/src/main/java/cn/stylefeng/roses/kernel/system/modular/menu/factory/AntdMenusFactory.java @@ -212,15 +212,21 @@ public class AntdMenusFactory { } } + // 遍历一遍后,当前菜单没按钮,则直接略过 + if (ObjectUtil.isEmpty(menuButtonList)) { + menuAndButtonTreeResponse.setButtons(menuButtonList); + continue; + } + long checkedButtonsNumber = menuButtonList.stream().filter(MenuAndButtonTreeResponse::getChecked).count(); // 统计选中的数量 - if (checkedButtonsNumber == menuButtonList.size()) { - menuAndButtonTreeResponse.setChecked(true); - menuAndButtonTreeResponse.setIndeterminate(false); - } else if (checkedButtonsNumber == 0) { + if (checkedButtonsNumber == 0) { menuAndButtonTreeResponse.setChecked(false); menuAndButtonTreeResponse.setIndeterminate(false); + } else if (checkedButtonsNumber == menuButtonList.size()) { + menuAndButtonTreeResponse.setChecked(true); + menuAndButtonTreeResponse.setIndeterminate(false); } else { menuAndButtonTreeResponse.setChecked(false); menuAndButtonTreeResponse.setIndeterminate(true); diff --git a/kernel-s-system/system-business-menu/src/main/java/cn/stylefeng/roses/kernel/system/modular/menu/factory/IndeterminateFactory.java b/kernel-s-system/system-business-menu/src/main/java/cn/stylefeng/roses/kernel/system/modular/menu/factory/IndeterminateFactory.java index d00190da7..a707fda67 100644 --- a/kernel-s-system/system-business-menu/src/main/java/cn/stylefeng/roses/kernel/system/modular/menu/factory/IndeterminateFactory.java +++ b/kernel-s-system/system-business-menu/src/main/java/cn/stylefeng/roses/kernel/system/modular/menu/factory/IndeterminateFactory.java @@ -58,12 +58,12 @@ public class IndeterminateFactory { int childrenSize = children.size(); // 统计选中的数量 - if (selectedCount == childrenSize) { - menuAndButtonTreeRespons.setChecked(true); - menuAndButtonTreeRespons.setIndeterminate(false); - } else if (selectedCount == 0) { + if (selectedCount == 0) { menuAndButtonTreeRespons.setChecked(false); menuAndButtonTreeRespons.setIndeterminate(false); + } else if (selectedCount == childrenSize) { + menuAndButtonTreeRespons.setChecked(true); + menuAndButtonTreeRespons.setIndeterminate(false); } else { menuAndButtonTreeRespons.setChecked(false); menuAndButtonTreeRespons.setIndeterminate(true); diff --git a/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/SysResourceServiceImpl.java b/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/SysResourceServiceImpl.java index ecb41145e..bbfb9d7f7 100644 --- a/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/SysResourceServiceImpl.java +++ b/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/SysResourceServiceImpl.java @@ -197,12 +197,12 @@ public class SysResourceServiceImpl extends ServiceImpl