1. 简化 ruoyi 获取菜单列表时,和前端耦合性比较重的情况
2. 删除 MenuDO 表非关键性字段,进一步简化模型
This commit is contained in:
@@ -9,12 +9,12 @@ Content-Type: application/json
|
||||
"code": "1024"
|
||||
}
|
||||
|
||||
### 请求 /get-info 接口 => 成功
|
||||
GET {{baseUrl}}/get-info
|
||||
### 请求 /get-permission-info 接口 => 成功
|
||||
GET {{baseUrl}}/get-permission-info
|
||||
Authorization: Bearer {{token}}
|
||||
|
||||
### 请求 /get-routers 接口 => 成功
|
||||
GET {{baseUrl}}/get-routers
|
||||
### 请求 /list-menus 接口 => 成功
|
||||
GET {{baseUrl}}/list-menus
|
||||
Authorization: Bearer {{token}}
|
||||
|
||||
### 请求 /druid/xxx 接口 => 失败 TODO 临时测试
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package cn.iocoder.dashboard.modules.system.controller.auth;
|
||||
|
||||
import cn.iocoder.dashboard.common.pojo.CommonResult;
|
||||
import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthGetInfoRespVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthGetRouterRespVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthMenuRespVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthPermissionInfoRespVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthLoginReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthLoginRespVO;
|
||||
import cn.iocoder.dashboard.modules.system.service.auth.SysAuthService;
|
||||
@@ -35,17 +35,17 @@ public class SysAuthController {
|
||||
return success(SysAuthLoginRespVO.builder().token(token).build());
|
||||
}
|
||||
|
||||
@ApiOperation("获取登陆用户的信息")
|
||||
@GetMapping("/get-info")
|
||||
public CommonResult<SysAuthGetInfoRespVO> getInfo() {
|
||||
SysAuthGetInfoRespVO respVO = authService.getInfo(getLoginUserId(), getLoginUserRoleIds());
|
||||
@ApiOperation("获取登陆用户的权限信息")
|
||||
@GetMapping("/get-permission-info")
|
||||
public CommonResult<SysAuthPermissionInfoRespVO> getPermissionInfo() {
|
||||
SysAuthPermissionInfoRespVO respVO = authService.getPermissionInfo(getLoginUserId(), getLoginUserRoleIds());
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@ApiOperation("获得菜单 Vue 路由")
|
||||
@GetMapping("get-routers")
|
||||
public CommonResult<List<SysAuthGetRouterRespVO>> getRouters() {
|
||||
List<SysAuthGetRouterRespVO> respVOList = authService.getRouters(getLoginUserId(), getLoginUserRoleIds());
|
||||
@ApiOperation("获得登陆用户的菜单列表")
|
||||
@GetMapping("list-menus")
|
||||
public CommonResult<List<SysAuthMenuRespVO>> listMenus() {
|
||||
List<SysAuthMenuRespVO> respVOList = authService.listMenus(getLoginUserId(), getLoginUserRoleIds());
|
||||
return success(respVOList);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
package cn.iocoder.dashboard.modules.system.controller.auth.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 路由配置信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SysAuthGetRouterRespVO {
|
||||
|
||||
/**
|
||||
* 菜单编号
|
||||
*/
|
||||
private Long menuId;
|
||||
/**
|
||||
* 父菜单编号
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 路由名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 路由地址
|
||||
*/
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现
|
||||
*/
|
||||
private boolean hidden;
|
||||
|
||||
/**
|
||||
* 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
|
||||
*/
|
||||
private String redirect;
|
||||
|
||||
/**
|
||||
* 组件地址
|
||||
*/
|
||||
private String component;
|
||||
|
||||
/**
|
||||
* 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
|
||||
*/
|
||||
private Boolean alwaysShow;
|
||||
|
||||
/**
|
||||
* 其他元素
|
||||
*/
|
||||
private MetaVO meta;
|
||||
|
||||
/**
|
||||
* 子路由
|
||||
*/
|
||||
private List<SysAuthGetRouterRespVO> children;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public static class MetaVO {
|
||||
|
||||
/**
|
||||
* 设置该路由在侧边栏和面包屑中展示的名字
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 设置该路由的图标,对应路径src/assets/icons/svg
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 设置为true,则不会被 <keep-alive>缓存
|
||||
*/
|
||||
private boolean noCache;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package cn.iocoder.dashboard.modules.system.controller.auth.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("登陆用户的菜单信息 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SysAuthMenuRespVO {
|
||||
|
||||
/**
|
||||
* 菜单编号
|
||||
*/
|
||||
private Long menuId;
|
||||
/**
|
||||
* 父菜单编号
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
private String menuName;
|
||||
|
||||
/**
|
||||
* 路由地址
|
||||
*/
|
||||
private String path;
|
||||
/**
|
||||
* 组件地址
|
||||
*/
|
||||
private String component;
|
||||
|
||||
/**
|
||||
* 菜单图标
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 子路由
|
||||
*/
|
||||
private List<SysAuthMenuRespVO> children;
|
||||
|
||||
}
|
||||
@@ -9,20 +9,20 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@ApiModel("获得用户信息 Resp VO")
|
||||
@ApiModel(value = "登陆用户的权限信息 Response VO", description = "额外包括用户信息和角色列表")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SysAuthGetInfoRespVO {
|
||||
public class SysAuthPermissionInfoRespVO {
|
||||
|
||||
@ApiModelProperty(value = "用户信息", required = true)
|
||||
private UserVO user;
|
||||
|
||||
@ApiModelProperty(value = "角色权限数组", required = true)
|
||||
@ApiModelProperty(value = "角色标识数组", required = true)
|
||||
private Set<String> roles;
|
||||
|
||||
@ApiModelProperty(value = "菜单权限数组", required = true)
|
||||
@ApiModelProperty(value = "操作权限数组", required = true)
|
||||
private Set<String> permissions;
|
||||
|
||||
@ApiModel("用户信息 VO")
|
||||
Reference in New Issue
Block a user