提交swagger 对象接口补充
This commit is contained in:
@@ -7,6 +7,7 @@ import com.label.common.result.Result;
|
||||
import com.label.dto.SourceResponse;
|
||||
import com.label.service.SourceService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -38,7 +39,9 @@ public class SourceController {
|
||||
@RequireRole("UPLOADER")
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public Result<SourceResponse> upload(
|
||||
@Parameter(description = "上传文件,支持文本、图片、视频", required = true)
|
||||
@RequestParam("file") MultipartFile file,
|
||||
@Parameter(description = "资料类型,可选值:text、image、video", example = "text", required = true)
|
||||
@RequestParam("dataType") String dataType,
|
||||
HttpServletRequest request) {
|
||||
TokenPrincipal principal = (TokenPrincipal) request.getAttribute("__token_principal__");
|
||||
@@ -53,9 +56,13 @@ public class SourceController {
|
||||
@GetMapping("/list")
|
||||
@RequireRole("UPLOADER")
|
||||
public Result<PageResult<SourceResponse>> list(
|
||||
@Parameter(description = "页码,从 1 开始", example = "1")
|
||||
@RequestParam(defaultValue = "1") int page,
|
||||
@Parameter(description = "每页条数", example = "20")
|
||||
@RequestParam(defaultValue = "20") int pageSize,
|
||||
@Parameter(description = "资料类型过滤,可选值:text、image、video", example = "text")
|
||||
@RequestParam(required = false) String dataType,
|
||||
@Parameter(description = "资料状态过滤", example = "PENDING")
|
||||
@RequestParam(required = false) String status,
|
||||
HttpServletRequest request) {
|
||||
TokenPrincipal principal = (TokenPrincipal) request.getAttribute("__token_principal__");
|
||||
@@ -68,7 +75,9 @@ public class SourceController {
|
||||
@Operation(summary = "查询资料详情")
|
||||
@GetMapping("/{id}")
|
||||
@RequireRole("UPLOADER")
|
||||
public Result<SourceResponse> findById(@PathVariable Long id) {
|
||||
public Result<SourceResponse> findById(
|
||||
@Parameter(description = "资料 ID", example = "1001")
|
||||
@PathVariable Long id) {
|
||||
return Result.success(sourceService.findById(id));
|
||||
}
|
||||
|
||||
@@ -79,7 +88,10 @@ public class SourceController {
|
||||
@Operation(summary = "删除资料")
|
||||
@DeleteMapping("/{id}")
|
||||
@RequireRole("ADMIN")
|
||||
public Result<Void> delete(@PathVariable Long id, HttpServletRequest request) {
|
||||
public Result<Void> delete(
|
||||
@Parameter(description = "资料 ID", example = "1001")
|
||||
@PathVariable Long id,
|
||||
HttpServletRequest request) {
|
||||
TokenPrincipal principal = (TokenPrincipal) request.getAttribute("__token_principal__");
|
||||
sourceService.delete(id, principal.getCompanyId());
|
||||
return Result.success(null);
|
||||
|
||||
Reference in New Issue
Block a user