use of com.github.liuweijw.core.beans.system.AuthMenu in project fw-cloud-framework by liuweijw.
the class ApiController method findMenuByRole.
/**
* 通过用户名查询用户菜单
*/
@GetMapping("/findMenuByRole/{roleCode}")
public Set<AuthPermission> findMenuByRole(@PathVariable String roleCode) {
Set<AuthPermission> permissions = new HashSet<AuthPermission>();
Set<AuthMenu> menus = menuService.findMenuByRole(roleCode);
if (null == menus || menus.size() == 0)
return permissions;
menus.stream().forEach(r -> {
permissions.add(new AuthPermission(r.getUrl()));
});
return permissions;
}
use of com.github.liuweijw.core.beans.system.AuthMenu 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.core.beans.system.AuthMenu in project fw-cloud-framework by liuweijw.
the class MenuServiceImpl method findMenuByRole.
@Override
public Set<AuthMenu> findMenuByRole(String roleCode) {
if (StringHelper.isBlank(roleCode))
return null;
Role role = roleService.findRoleByCode(roleCode.trim());
if (null == role)
return null;
List<Menu> rList = this.findMenuByRoleId(role.getRoleId());
if (null == rList || rList.size() == 0)
return null;
Set<AuthMenu> mList = new HashSet<AuthMenu>();
for (Menu m : rList) {
AuthMenu authMenu = new AuthMenu();
BeanUtils.copyProperties(m, authMenu);
mList.add(authMenu);
}
return mList;
}
use of com.github.liuweijw.core.beans.system.AuthMenu in project fw-cloud-framework by liuweijw.
the class PermissionFeignApiClient method findMenuByRole.
@Override
@ApiOperation(httpMethod = GET, value = "通过角色获取菜单权限")
@ApiImplicitParam(name = "roleCode", value = "用户roleCode", required = true, dataType = "string", paramType = "path")
public Set<AuthPermission> findMenuByRole(@PathVariable("roleCode") String roleCode) {
Set<AuthPermission> permissions = new HashSet<AuthPermission>();
if (StringHelper.isBlank(roleCode))
return permissions;
Set<AuthMenu> menus = menuService.findMenuByRole(roleCode);
if (null == menus || menus.size() == 0)
return permissions;
menus.stream().forEach(r -> {
permissions.add(new AuthPermission(r.getUrl()));
});
return permissions;
}
use of com.github.liuweijw.core.beans.system.AuthMenu 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