| | |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * 权限 Controller,提供赋予用户、角色的权限的 API 接口 |
| | | * |
| | | * @author 芋道源码 |
| | | */ |
| | | @Tag(name = "管理后台 - 权限") |
| | | @RestController |
| | | @RequestMapping("/system/permission") |
| | |
| | | @Parameter(name = "roleId", description = "角色编号", required = true) |
| | | @GetMapping("/list-role-menus") |
| | | @PreAuthorize("@ss.hasPermission('system:permission:assign-role-menu')") |
| | | public CommonResult<Set<Long>> getRoleMenuList(Long roleId) { |
| | | public CommonResult<Set<Long>> getRoleMenuList(@RequestParam("roleId") Long roleId) { |
| | | // 显式声明必填:roleId 缺失时由 Spring 返回 400「请求参数不正确」, |
| | | // 而不是传到 RoleServiceImpl 用 null 作为缓存 key,抛 |
| | | // IllegalArgumentException: Null key returned for cache operation 变成 500 |
| | | return success(permissionService.getRoleMenuListByRoleId(roleId)); |
| | | } |
| | | |