⚡ 优化. 定义常量菜单树根节点
This commit is contained in:
1 parent
532dfe94f3
commit
f6fb9d0c56
2 files changed
+9
-2
No files matched your search
+5
@@ -47,6 +47,11 @@ public interface CommonConstants {
|
||||
*/
|
||||
String MENU = "0";
|
||||
|
||||
/**
|
||||
* 菜单树根节点
|
||||
*/
|
||||
Integer MENU_TREE_ROOT_ID = -1;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
|
||||
+4
-2
@@ -68,7 +68,7 @@ public class MenuController {
|
||||
.map(MenuTree::new)
|
||||
.sorted(Comparator.comparingInt(MenuTree::getSort))
|
||||
.collect(Collectors.toList());
|
||||
return new R<>(TreeUtil.build(menuTreeList, -1));
|
||||
return new R<>(TreeUtil.build(menuTreeList, CommonConstants.MENU_TREE_ROOT_ID));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,7 +78,9 @@ public class MenuController {
|
||||
*/
|
||||
@GetMapping(value = "/tree")
|
||||
public R getTree() {
|
||||
return new R<>(TreeUtil.buildTree(sysMenuService.list(Wrappers.emptyWrapper()), -1));
|
||||
return new R<>(TreeUtil.buildTree(sysMenuService
|
||||
.list(Wrappers.<SysMenu>lambdaQuery()
|
||||
.orderByAsc(SysMenu::getSort)), CommonConstants.MENU_TREE_ROOT_ID));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user