| | |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.IRoleService; |
| | | import com.stylefeng.guns.modular.system.service.ITUserService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.service.SysOperationService; |
| | | import com.stylefeng.guns.modular.system.utils.tips.SuccessTip; |
| | |
| | | |
| | | @Autowired |
| | | private SysOperationService sysOperation; |
| | | |
| | | @Autowired |
| | | private ITUserService itUserService; |
| | | |
| | | |
| | | |
| | |
| | | @GetMapping("/getAuthority") |
| | | @ResponseBody |
| | | public Object getAuthority(Integer userId) { |
| | | User user = userService.selectById(userId); |
| | | TUser user = itUserService.selectById(userId); |
| | | if(user==null){ |
| | | throw new GunsException(BizExceptionEnum.NO_THIS_USER); |
| | | } |
| | | String roleid = user.getRoleid(); |
| | | // 当前拥有的 |
| | | List<Relation> relations = roleService.selectAuthority(roleid); |
| | | List<Relation> relations = roleService.selectAuthority(String.valueOf(userId)); |
| | | List<Menu> menuList = roleService.getRelation1(relations.stream().map(Relation::getMenuid).collect(Collectors.toList())); |
| | | List<Menu> parent = menuList.stream().filter(role -> role.getPcode().equals("0")).collect(Collectors.toList()); |
| | | getChildren(parent,menuList); |
| | |
| | | @ApiOperation(value = "根据角色id获取权限信息",notes="根据角色id获取权限信息") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "roleId", value = "角色Id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "roleId", value = "用户Id", required = true, dataType = "int"), |
| | | }) |
| | | @GetMapping("/getAuthorityFromRole") |
| | | @ResponseBody |