mirror of https://gitee.com/stylefeng/roses
【7.0.2】更新角色分配资源的接口名
parent
ebcf892adf
commit
4be3471fb8
|
@ -53,25 +53,25 @@ public class ResourceController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取资源平级树列表,用于分配接口权限(适用于layui版本)
|
||||
* Layui版本--获取资源树列表,用于角色分配接口权限
|
||||
*
|
||||
* @author majianguo
|
||||
* @date 2021/1/9 15:07
|
||||
*/
|
||||
@GetResource(name = "获取资源平级树列表,用于分配接口权限", path = "/resource/getLateralTree")
|
||||
@GetResource(name = "Layui版本--获取资源树列表,用于角色分配接口权限", path = "/resource/getRoleResourceTree")
|
||||
public List<ResourceTreeNode> getLateralTree(SysRoleRequest sysRoleRequest) {
|
||||
return sysResourceService.getResourceTree(sysRoleRequest.getRoleId(), true);
|
||||
return sysResourceService.getResourceTree(sysRoleRequest.getRoleId(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取资源树列表,用于分配接口权限(适用于antd vue版本)
|
||||
* AntdVue版本--获取资源树列表,用于角色分配接口权限
|
||||
*
|
||||
* @author majianguo
|
||||
* @date 2021/1/9 15:07
|
||||
*/
|
||||
@GetResource(name = "获取资源树列表,用于分配接口权限", path = "/resource/getLateralTreeChildren")
|
||||
@GetResource(name = "AntdVue版本--获取资源树列表,用于角色分配接口权限", path = "/resource/getRoleResourceTreeAntdv")
|
||||
public ResponseData getLateralTreeChildren(SysRoleRequest sysRoleRequest) {
|
||||
List<ResourceTreeNode> resourceLateralTree = sysResourceService.getResourceTree(sysRoleRequest.getRoleId(), false);
|
||||
List<ResourceTreeNode> resourceLateralTree = sysResourceService.getResourceTree(sysRoleRequest.getRoleId(), true);
|
||||
return new SuccessResponseData(resourceLateralTree);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,14 +41,14 @@ public interface SysResourceService extends IService<SysResource> {
|
|||
List<SysResource> findList(ResourceRequest resourceRequest);
|
||||
|
||||
/**
|
||||
* 获取平级树节点列表
|
||||
* 获取资源平级树列表,用于分配接口权限
|
||||
*
|
||||
* @param roleId 角色id
|
||||
* @param lateralFlag true-不带树形结构,false-返回带树形结构的
|
||||
* @param roleId 角色id
|
||||
* @param treeBuildFlag true-带树形结构,false-不组装树形结构的
|
||||
* @author majianguo
|
||||
* @date 2021/1/9 15:08
|
||||
*/
|
||||
List<ResourceTreeNode> getResourceTree(Long roleId, Boolean lateralFlag);
|
||||
List<ResourceTreeNode> getResourceTree(Long roleId, Boolean treeBuildFlag);
|
||||
|
||||
/**
|
||||
* 获取资源树列表,用于生成api接口
|
||||
|
|
|
@ -85,7 +85,7 @@ public class SysResourceServiceImpl extends ServiceImpl<SysResourceMapper, SysRe
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ResourceTreeNode> getResourceTree(Long roleId, Boolean lateralFlag) {
|
||||
public List<ResourceTreeNode> getResourceTree(Long roleId, Boolean treeBuildFlag) {
|
||||
|
||||
List<ResourceTreeNode> res = new ArrayList<>();
|
||||
|
||||
|
@ -162,10 +162,10 @@ public class SysResourceServiceImpl extends ServiceImpl<SysResourceMapper, SysRe
|
|||
}
|
||||
|
||||
// 根据map组装资源树
|
||||
if (lateralFlag) {
|
||||
return res;
|
||||
} else {
|
||||
if (treeBuildFlag) {
|
||||
return new DefaultTreeBuildFactory<ResourceTreeNode>().doTreeBuild(res);
|
||||
} else {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue