增加 get-routers 接口的相关方法,未完全完成
This commit is contained in:
@@ -13,6 +13,10 @@ Content-Type: application/json
|
||||
GET {{baseUrl}}/get-info
|
||||
Authorization: Bearer {{token}}
|
||||
|
||||
### 请求 /get-routers 接口 => 成功
|
||||
GET {{baseUrl}}/get-routers
|
||||
Authorization: Bearer {{token}}
|
||||
|
||||
### 请求 /druid/xxx 接口 => 失败 TODO 临时测试
|
||||
GET http://127.0.0.1:8080/druid/123
|
||||
Authorization: Bearer {{token}}
|
||||
|
||||
@@ -2,6 +2,7 @@ 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.SysAuthLoginReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthLoginRespVO;
|
||||
import cn.iocoder.dashboard.modules.system.service.auth.SysAuthService;
|
||||
@@ -12,6 +13,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.dashboard.framework.security.core.util.SecurityUtils.getLoginUserId;
|
||||
import static cn.iocoder.dashboard.framework.security.core.util.SecurityUtils.getLoginUserRoleIds;
|
||||
@@ -39,4 +42,11 @@ public class SysAuthController {
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@ApiOperation("获得菜单 Vue 路由")
|
||||
@GetMapping("get-routers")
|
||||
public CommonResult<List<SysAuthGetRouterRespVO>> getRouters() {
|
||||
List<SysAuthGetRouterRespVO> respVOList = authService.getRouters(getLoginUserId(), getLoginUserRoleIds());
|
||||
return success(respVOList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package cn.iocoder.dashboard.modules.system.controller.auth.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 路由配置信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Data
|
||||
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
|
||||
public static class MetaVO {
|
||||
|
||||
/**
|
||||
* 设置该路由在侧边栏和面包屑中展示的名字
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 设置该路由的图标,对应路径src/assets/icons/svg
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 设置为true,则不会被 <keep-alive>缓存
|
||||
*/
|
||||
private boolean noCache;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user