Search in sources :

Example 6 with Tree

use of io.github.tesla.ops.system.domain.Tree in project tesla by linking12.

the class MenuServiceImpl method getTree.

@Override
public Tree<MenuDO> getTree() {
    List<Tree<MenuDO>> trees = new ArrayList<Tree<MenuDO>>();
    List<MenuDO> menuDOs = menuMapper.list(new HashMap<>(16));
    for (MenuDO sysMenuDO : menuDOs) {
        Tree<MenuDO> tree = new Tree<MenuDO>();
        tree.setId(sysMenuDO.getMenuId().toString());
        tree.setParentId(sysMenuDO.getParentId().toString());
        tree.setText(sysMenuDO.getName());
        trees.add(tree);
    }
    Tree<MenuDO> t = BuildTree.build(trees);
    return t;
}
Also used : MenuDO(io.github.tesla.ops.system.domain.MenuDO) ArrayList(java.util.ArrayList) Tree(io.github.tesla.ops.system.domain.Tree) BuildTree(io.github.tesla.ops.utils.BuildTree)

Aggregations

Tree (io.github.tesla.ops.system.domain.Tree)6 BuildTree (io.github.tesla.ops.utils.BuildTree)6 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)5 MenuDO (io.github.tesla.ops.system.domain.MenuDO)4 DeptDO (io.github.tesla.ops.system.domain.DeptDO)2 UserDO (io.github.tesla.ops.system.domain.UserDO)1 Cacheable (org.springframework.cache.annotation.Cacheable)1