mirror of https://gitee.com/maxjhandsome/pig
🍻 Writing code drunkenly.bulid->build
This commit is contained in:
parent
dc54f85271
commit
137cc8d1d4
|
@ -37,7 +37,7 @@ public class TreeUtil {
|
||||||
* @param treeNodes 传入的树节点列表
|
* @param treeNodes 传入的树节点列表
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public <T extends TreeNode> List<T> bulid(List<T> treeNodes, Object root) {
|
public <T extends TreeNode> List<T> buildByLoop(List<T> treeNodes, Object root) {
|
||||||
|
|
||||||
List<T> trees = new ArrayList<>();
|
List<T> trees = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ public class TreeUtil {
|
||||||
* @param root
|
* @param root
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<MenuTree> bulidTree(List<SysMenu> menus, int root) {
|
public List<MenuTree> buildTree(List<SysMenu> menus, int root) {
|
||||||
List<MenuTree> trees = new ArrayList<>();
|
List<MenuTree> trees = new ArrayList<>();
|
||||||
MenuTree node;
|
MenuTree node;
|
||||||
for (SysMenu menu : menus) {
|
for (SysMenu menu : menus) {
|
||||||
|
@ -116,6 +116,6 @@ public class TreeUtil {
|
||||||
node.setKeepAlive(menu.getKeepAlive());
|
node.setKeepAlive(menu.getKeepAlive());
|
||||||
trees.add(node);
|
trees.add(node);
|
||||||
}
|
}
|
||||||
return TreeUtil.bulid(trees, root);
|
return TreeUtil.buildByLoop(trees, root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class MenuController {
|
||||||
.map(MenuTree::new)
|
.map(MenuTree::new)
|
||||||
.sorted(Comparator.comparingInt(MenuTree::getSort))
|
.sorted(Comparator.comparingInt(MenuTree::getSort))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
return new R<>(TreeUtil.bulid(menuTreeList, -1));
|
return new R<>(TreeUtil.buildByLoop(menuTreeList, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,7 +73,7 @@ public class MenuController {
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/tree")
|
@GetMapping(value = "/tree")
|
||||||
public R getTree() {
|
public R getTree() {
|
||||||
return new R<>(TreeUtil.bulidTree(sysMenuService.list(Wrappers.emptyWrapper()), -1));
|
return new R<>(TreeUtil.buildTree(sysMenuService.list(Wrappers.emptyWrapper()), -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -154,6 +154,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||||
node.setName(dept.getName());
|
node.setName(dept.getName());
|
||||||
return node;
|
return node;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
return TreeUtil.bulid(treeList, 0);
|
return TreeUtil.buildByLoop(treeList, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue