| | |
| | | |
| | | @Autowired |
| | | private ISysMenuService sysMenuService; |
| | | @Autowired |
| | | private ISysDoctorMenuService sysDoctorMenuService; |
| | | @Autowired |
| | | private IDoctorService doctorService; |
| | | |
| | | /** |
| | | * 分页查询 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 返回角色的菜单集合 |
| | | * |
| | | * @param sysRoleMenu |
| | | * @return |
| | | */ |
| | | @PostMapping("/role") |
| | | @ApiOperation(value = "返回角色的菜单集合", tags = {"权限菜单"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseData getRoleResource(@RequestBody SysRoleMenu sysRoleMenu) throws BusinessException { |
| | | List<MenuVO> list = sysMenuService.findMenuByRoleId(doctorService.updateRole(sysRoleMenu.getRoleId().intValue())); |
| | | return ResponseData.success(list.stream().filter(item -> list.stream().noneMatch(vo -> Objects.nonNull(vo) && Objects.nonNull(vo.getParentId()) |
| | | && vo.getParentId().equals(item.getId()))).map(item -> item.getId().toString()).collect(Collectors.toList())); |
| | | } |
| | | |
| | | /** |
| | | * 返回当前登录用户的树形菜单集合 |
| | | * |
| | | * @return 当前用户的树形菜单 |
| | |
| | | return ResponseData.success(TreeUtil.bulidRouter(menuTreeList)); |
| | | } |
| | | |
| | | /** |
| | | * 返回当前登录用户的权限码 |
| | | * |
| | | * @return |
| | | * @throws BusinessException |
| | | */ |
| | | @GetMapping("/user/permission") |
| | | @ApiOperation(value = "返回当前登录用户的权限码", tags = {"权限菜单"}, notes = "", response = String.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseData getPermission() throws BusinessException { |
| | | // 获取当前登录用户信息 |
| | | LoginUserVo loginUserVo = LoginHelper.getUser(); |
| | | if (Objects.isNull(loginUserVo)) { |
| | | throw new BusinessException("请登录", ErrorCodeConstants.FAIL.getValue()); |
| | | } |
| | | return ResponseData.success(sysDoctorMenuService.getPermission(loginUserVo.getId())); |
| | | } |
| | | } |
| | | |