|
|
@@ -137,17 +137,26 @@ public class SysMenuService extends ServiceImpl<SysMenuMapper, SysMenu> {
|
|
|
Set<Long> included = new HashSet<>();
|
|
|
for (SysMenu m : all) {
|
|
|
if (authed.contains(m.getId()) && Integer.valueOf(1).equals(m.getVisible())) {
|
|
|
- // 向上补全父级链
|
|
|
+ // 向上补全父级链,要求路径上所有祖先节点均 visible=1
|
|
|
+ boolean chainVisible = true;
|
|
|
Long cur = m.getId();
|
|
|
- while (cur != null && !included.contains(cur) && idSet.contains(cur)) {
|
|
|
- included.add(cur);
|
|
|
+ List<Long> chainNodes = new ArrayList<>();
|
|
|
+ while (cur != null && idSet.contains(cur)) {
|
|
|
SysMenu node = byId.get(cur);
|
|
|
+ if (!Integer.valueOf(1).equals(node.getVisible())) {
|
|
|
+ chainVisible = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ chainNodes.add(cur);
|
|
|
Long pid = node.getParentId() == null ? 0L : node.getParentId();
|
|
|
if (pid == 0L || !idSet.contains(pid)) {
|
|
|
break;
|
|
|
}
|
|
|
cur = pid;
|
|
|
}
|
|
|
+ if (chainVisible) {
|
|
|
+ included.addAll(chainNodes);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|