Search in sources :

Example 1 with Module

use of com.github.liuweijw.business.admin.domain.Module in project fw-cloud-framework by liuweijw.

the class MenuServiceImpl method findAllMenuTree.

// 目前只支持二级菜单,若有三级,则改递归即可
@Override
public List<MenuTree> findAllMenuTree() {
    List<Menu> rList = this.findMenuList();
    List<Module> moduleList = this.moduleService.getAllList();
    List<MenuTree> menuTreeList = new ArrayList<MenuTree>();
    rList.forEach(menu -> {
        if (menu.getPid() != 0 && null != moduleList && moduleList.size() > 0) {
            moduleList.forEach(m -> {
                String id = menu.getPath() + "_" + m.getCode();
                menuTreeList.add(new MenuTree(id, menu.getMenuId() + "", m.getName()));
            });
        }
        menuTreeList.add(new MenuTree(menu.getMenuId() + "", menu.getPid() + "", menu.getMenuName()));
    });
    return TreeUtil.build(menuTreeList, "0");
}
Also used : MenuTree(com.github.liuweijw.business.commons.tree.MenuTree) ArrayList(java.util.ArrayList) AuthMenu(com.github.liuweijw.core.beans.system.AuthMenu) QMenu(com.github.liuweijw.business.admin.domain.QMenu) QRoleMenu(com.github.liuweijw.business.admin.domain.QRoleMenu) Menu(com.github.liuweijw.business.admin.domain.Menu) Module(com.github.liuweijw.business.admin.domain.Module)

Aggregations

Menu (com.github.liuweijw.business.admin.domain.Menu)1 Module (com.github.liuweijw.business.admin.domain.Module)1 QMenu (com.github.liuweijw.business.admin.domain.QMenu)1 QRoleMenu (com.github.liuweijw.business.admin.domain.QRoleMenu)1 MenuTree (com.github.liuweijw.business.commons.tree.MenuTree)1 AuthMenu (com.github.liuweijw.core.beans.system.AuthMenu)1 ArrayList (java.util.ArrayList)1