chore: 补充文件上传相关接口的文档参数注解

This commit is contained in:
2025-05-21 22:26:30 +08:00
parent 9d6d7984d5
commit 5a9958c36c
3 changed files with 10 additions and 6 deletions

View File

@@ -66,9 +66,10 @@ public class CommonController {
private final OptionService optionService;
@Operation(summary = "上传文件", description = "上传文件")
@Parameter(name = "parentPath", description = "上级目录", example = "/", in = ParameterIn.QUERY)
@PostMapping("/file")
public FileUploadResp upload(@NotNull(message = "文件不能为空") MultipartFile file,
String parentPath) throws IOException {
public FileUploadResp upload(@NotNull(message = "文件不能为空") @RequestPart MultipartFile file,
@RequestParam(required = false) String parentPath) throws IOException {
ValidationUtils.throwIf(file::isEmpty, "文件不能为空");
FileInfo fileInfo = fileService.upload(file, parentPath);
return FileUploadResp.builder()

View File

@@ -18,6 +18,8 @@ package top.continew.admin.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
@@ -64,11 +66,12 @@ public class FileController extends BaseController<FileService, FileResp, FileRe
* @return 文件上传响应参数
* @throws IOException /
*/
@SaCheckPermission("system:file:upload")
@Operation(summary = "上传文件", description = "上传文件")
@Parameter(name = "parentPath", description = "上级目录", example = "/", in = ParameterIn.QUERY)
@SaCheckPermission("system:file:upload")
@PostMapping("/upload")
public FileUploadResp upload(@NotNull(message = "文件不能为空") MultipartFile file,
String parentPath) throws IOException {
public FileUploadResp upload(@NotNull(message = "文件不能为空") @RequestPart MultipartFile file,
@RequestParam(required = false) String parentPath) throws IOException {
ValidationUtils.throwIf(file::isEmpty, "文件不能为空");
FileInfo fileInfo = baseService.upload(file, parentPath);
return FileUploadResp.builder()

View File

@@ -86,7 +86,7 @@ public class UserController extends BaseController<UserService, UserResp, UserDe
@Operation(summary = "解析导入数据", description = "解析导入数据")
@SaCheckPermission("system:user:import")
@PostMapping("/import/parse")
public UserImportParseResp parseImport(@NotNull(message = "文件不能为空") MultipartFile file) {
public UserImportParseResp parseImport(@NotNull(message = "文件不能为空") @RequestPart MultipartFile file) {
ValidationUtils.throwIf(file::isEmpty, "文件不能为空");
return baseService.parseImport(file);
}