feat: 升级SpringBoot3

This commit is contained in:
haoxr
2023-02-06 09:40:50 +08:00
parent 115de0bfcb
commit 9d73197bd8
43 changed files with 365 additions and 383 deletions

View File

@@ -9,16 +9,17 @@ import com.youlai.system.pojo.form.RoleForm;
import com.youlai.system.pojo.query.RolePageQuery;
import com.youlai.system.pojo.vo.role.RolePageVO;
import com.youlai.system.service.SysRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import jakarta.validation.Valid;
import java.util.List;
@Api(tags = "角色接口")
@Tag(name = "角色接口")
@RestController
@RequestMapping("/api/v1/roles")
@RequiredArgsConstructor
@@ -26,72 +27,72 @@ public class SysRoleController {
private final SysRoleService roleService;
@ApiOperation(value = "角色分页列表")
@Operation(summary = "角色分页列表")
@GetMapping("/pages")
public PageResult<RolePageVO> listRolePages(RolePageQuery queryParams) {
Page<RolePageVO> result = roleService.listRolePages(queryParams);
return PageResult.success(result);
}
@ApiOperation(value = "角色下拉列表")
@Operation(summary = "角色下拉列表")
@GetMapping("/options")
public Result<List<Option>> listRoleOptions() {
List<Option> list = roleService.listRoleOptions();
return Result.success(list);
}
@ApiOperation(value = "角色详情")
@Operation(summary = "角色详情")
@GetMapping("/{roleId}")
public Result getRoleDetail(
@ApiParam("角色ID") @PathVariable Long roleId
@Parameter(name ="角色ID") @PathVariable Long roleId
) {
SysRole role = roleService.getById(roleId);
return Result.success(role);
}
@ApiOperation(value = "新增角色")
@Operation(summary = "新增角色")
@PostMapping
public Result addRole(@Valid @RequestBody RoleForm roleForm) {
boolean result = roleService.saveRole(roleForm);
return Result.judge(result);
}
@ApiOperation(value = "修改角色")
@Operation(summary = "修改角色")
@PutMapping(value = "/{id}")
public Result updateRole(@Valid @RequestBody RoleForm roleForm) {
boolean result = roleService.saveRole(roleForm);
return Result.judge(result);
}
@ApiOperation(value = "删除角色")
@Operation(summary = "删除角色")
@DeleteMapping("/{ids}")
public Result deleteRoles(
@ApiParam("删除角色,多个以英文逗号(,)分割") @PathVariable String ids
@Parameter(name ="删除角色,多个以英文逗号(,)分割") @PathVariable String ids
) {
boolean result = roleService.deleteRoles(ids);
return Result.judge(result);
}
@ApiOperation(value = "修改角色状态")
@Operation(summary = "修改角色状态")
@PutMapping(value = "/{roleId}/status")
public Result updateRoleStatus(
@ApiParam("角色ID") @PathVariable Long roleId,
@ApiParam("角色状态:1-启用0-禁用") @RequestParam Integer status
@Parameter(name ="角色ID") @PathVariable Long roleId,
@Parameter(name ="角色状态:1-启用0-禁用") @RequestParam Integer status
) {
boolean result = roleService.updateRoleStatus(roleId, status);
return Result.judge(result);
}
@ApiOperation(value = "获取角色的菜单ID集合")
@Operation(summary = "获取角色的菜单ID集合")
@GetMapping("/{roleId}/menuIds")
public Result<List<Long>> getRoleMenuIds(
@ApiParam("角色ID") @PathVariable Long roleId
@Parameter(name ="角色ID") @PathVariable Long roleId
) {
List<Long> resourceIds = roleService.getRoleMenuIds(roleId);
return Result.success(resourceIds);
}
@ApiOperation(value = "分配角色的资源权限")
@Operation(summary = "分配角色的资源权限")
@PutMapping("/{roleId}/menus")
public Result updateRoleMenus(
@PathVariable Long roleId,