| | |
| | | */ |
| | | @GetMapping("/getRoleListByAdmin/{adminId}") |
| | | public ResponseVO<Object> getRoleListByAdmin(@PathVariable Long adminId) { |
| | | if (!permissionConfig.check(MenuEnum.ROLE_BY_ADMIN.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | List<Role> roles = roleService.listByAdminId(adminId); |
| | | return ResponseUtil.success(roles); |
| | | } |
| | |
| | | |
| | | @PostMapping("/add") |
| | | public ResponseVO<Object> addRole(@Validated @RequestBody RoleParam param) { |
| | | if (!permissionConfig.check(MenuEnum.ROLE_ADD.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | boolean result = roleService.addRole(param); |
| | | if (result) { |
| | | return ResponseUtil.success("添加成功"); |
| | |
| | | |
| | | @PostMapping("/update/{roleId}") |
| | | public ResponseVO<Object> updateRole(@PathVariable Long roleId, @Validated @RequestBody RoleParam param) { |
| | | if (!permissionConfig.check(MenuEnum.ROLE_UPDATE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | boolean result = roleService.updateRole(roleId, param); |
| | | if (result) { |
| | | return ResponseUtil.success("编辑成功"); |
| | |
| | | |
| | | @PostMapping("/del/{roleId}") |
| | | public ResponseVO<Object> delRole(@PathVariable Long roleId) { |
| | | if (!permissionConfig.check(MenuEnum.ROLE_DELETE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | boolean result = roleService.delRole(roleId); |
| | | if (result) { |
| | | return ResponseUtil.success("删除成功"); |