use of com.github.liuweijw.business.commons.tree.MenuTree 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");
}
use of com.github.liuweijw.business.commons.tree.MenuTree in project fw-cloud-framework by liuweijw.
the class MenuServiceImpl method findRoleMenuTree.
@Override
public List<MenuTree> findRoleMenuTree(String roleCode) {
Set<AuthMenu> menuList = findMenuByRole(roleCode);
List<MenuTree> menuTreeList = new ArrayList<MenuTree>();
menuList.forEach(menu -> {
menuTreeList.add(new MenuTree(menu));
});
return TreeUtil.build(menuTreeList, 0);
}
use of com.github.liuweijw.business.commons.tree.MenuTree in project fw-cloud-framework by liuweijw.
the class MenuController method menuTreeList.
// 获取所有菜单列表 以及功能权限
@GetMapping(value = "/menuTreeList/{roleCode}")
@PrePermissions(value = Functional.VIEW)
public R<MenuTreeBean> menuTreeList(@PathVariable("roleCode") String roleCode) {
MenuTreeBean menuTreeBean = new MenuTreeBean();
List<MenuTree> menuTree = menuService.findAllMenuTree();
menuTreeBean.setMenuList(menuTree);
Set<String> permissions = new HashSet<String>();
permissions.addAll(permissionService.findMenuPermissions(roleCode));
menuTreeBean.setPermissions(permissions.toArray(new String[permissions.size()]));
return new R<MenuTreeBean>().data(menuTreeBean);
}
use of com.github.liuweijw.business.commons.tree.MenuTree in project fw-cloud-framework by liuweijw.
the class MenuController method menuTreeList.
// 获取所有菜单列表
@GetMapping(value = "/menuTreeAllList")
@PrePermissions(value = Functional.VIEW)
public R<MenuTreeBean> menuTreeList() {
MenuTreeBean menuTreeBean = new MenuTreeBean();
List<MenuTree> menuTree = menuService.findAllMenuTreeList();
menuTreeBean.setMenuList(menuTree);
return new R<MenuTreeBean>().data(menuTreeBean);
}
use of com.github.liuweijw.business.commons.tree.MenuTree in project fw-cloud-framework by liuweijw.
the class MenuServiceImpl method findAllMenuTreeList.
@Override
public List<MenuTree> findAllMenuTreeList() {
List<Menu> rList = this.findMenuList();
List<MenuTree> menuTreeList = new ArrayList<MenuTree>();
rList.forEach(menu -> {
AuthMenu authMenu = new AuthMenu();
BeanUtils.copyProperties(menu, authMenu);
menuTreeList.add(new MenuTree(authMenu));
});
return TreeUtil.build(menuTreeList, "0");
}
Aggregations