| | |
| | | import org.springblade.modules.system.entity.Role; |
| | | import org.springblade.modules.system.service.IRoleService; |
| | | import org.springblade.modules.system.vo.GrantVO; |
| | | import org.springblade.modules.system.vo.RoleParam; |
| | | import org.springblade.modules.system.vo.RoleVO; |
| | | import org.springblade.modules.system.wrapper.RoleWrapper; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @AllArgsConstructor |
| | | @RequestMapping(AppConstant.APPLICATION_SYSTEM_NAME + "/role") |
| | | @Api(value = "角色", tags = "角色") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public class RoleController extends BladeController { |
| | | |
| | | private final IRoleService roleService; |
| | |
| | | return R.data(RoleWrapper.build().entityVO(detail)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @GetMapping("/details") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详情", notes = "传入role") |
| | | public R<Role> details(Role role) { |
| | | Role detail = roleService.getOne(Condition.getQueryWrapper(role)); |
| | | return R.data(detail); |
| | | } |
| | | |
| | | /** |
| | | * 列表 |
| | | */ |
| | |
| | | public R<List<RoleVO>> list(@ApiIgnore @RequestParam Map<String, Object> role, BladeUser bladeUser) { |
| | | QueryWrapper<Role> queryWrapper = Condition.getQueryWrapper(role, Role.class); |
| | | List<Role> list = roleService.list((!bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) ? queryWrapper.lambda().eq(Role::getTenantId, bladeUser.getTenantId()) : queryWrapper); |
| | | return R.data(RoleWrapper.build().listNodeVO(list)); |
| | | } |
| | | |
| | | /** |
| | | * 自定义列表(只获取当前角色下级角色) |
| | | * @param roleParam |
| | | * @return |
| | | */ |
| | | @GetMapping("/getRoleList") |
| | | public R<List<RoleVO>> getRoleList(RoleParam roleParam) { |
| | | List<Role> list = roleService.getRoleList(roleParam); |
| | | return R.data(RoleWrapper.build().listNodeVO(list)); |
| | | } |
| | | |
| | |
| | | return R.status(temp); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/selectRole") |
| | | public R selectRole() { |
| | | return R.data(roleService.selectRole()); |
| | | } |
| | | |
| | | |
| | | } |