mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 10:57:13 +08:00 
			
		
		
		
	chore: 补充文件上传相关接口的文档参数注解
This commit is contained in:
		| @@ -66,9 +66,10 @@ public class CommonController { | |||||||
|     private final OptionService optionService; |     private final OptionService optionService; | ||||||
|  |  | ||||||
|     @Operation(summary = "上传文件", description = "上传文件") |     @Operation(summary = "上传文件", description = "上传文件") | ||||||
|  |     @Parameter(name = "parentPath", description = "上级目录", example = "/", in = ParameterIn.QUERY) | ||||||
|     @PostMapping("/file") |     @PostMapping("/file") | ||||||
|     public FileUploadResp upload(@NotNull(message = "文件不能为空") MultipartFile file, |     public FileUploadResp upload(@NotNull(message = "文件不能为空") @RequestPart MultipartFile file, | ||||||
|                                  String parentPath) throws IOException { |                                  @RequestParam(required = false) String parentPath) throws IOException { | ||||||
|         ValidationUtils.throwIf(file::isEmpty, "文件不能为空"); |         ValidationUtils.throwIf(file::isEmpty, "文件不能为空"); | ||||||
|         FileInfo fileInfo = fileService.upload(file, parentPath); |         FileInfo fileInfo = fileService.upload(file, parentPath); | ||||||
|         return FileUploadResp.builder() |         return FileUploadResp.builder() | ||||||
|   | |||||||
| @@ -18,6 +18,8 @@ package top.continew.admin.controller.system; | |||||||
|  |  | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
| import io.swagger.v3.oas.annotations.Operation; | 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 io.swagger.v3.oas.annotations.tags.Tag; | ||||||
| import jakarta.validation.Valid; | import jakarta.validation.Valid; | ||||||
| import jakarta.validation.constraints.NotNull; | import jakarta.validation.constraints.NotNull; | ||||||
| @@ -64,11 +66,12 @@ public class FileController extends BaseController<FileService, FileResp, FileRe | |||||||
|      * @return 文件上传响应参数 |      * @return 文件上传响应参数 | ||||||
|      * @throws IOException / |      * @throws IOException / | ||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:file:upload") |  | ||||||
|     @Operation(summary = "上传文件", description = "上传文件") |     @Operation(summary = "上传文件", description = "上传文件") | ||||||
|  |     @Parameter(name = "parentPath", description = "上级目录", example = "/", in = ParameterIn.QUERY) | ||||||
|  |     @SaCheckPermission("system:file:upload") | ||||||
|     @PostMapping("/upload") |     @PostMapping("/upload") | ||||||
|     public FileUploadResp upload(@NotNull(message = "文件不能为空") MultipartFile file, |     public FileUploadResp upload(@NotNull(message = "文件不能为空") @RequestPart MultipartFile file, | ||||||
|                                  String parentPath) throws IOException { |                                  @RequestParam(required = false) String parentPath) throws IOException { | ||||||
|         ValidationUtils.throwIf(file::isEmpty, "文件不能为空"); |         ValidationUtils.throwIf(file::isEmpty, "文件不能为空"); | ||||||
|         FileInfo fileInfo = baseService.upload(file, parentPath); |         FileInfo fileInfo = baseService.upload(file, parentPath); | ||||||
|         return FileUploadResp.builder() |         return FileUploadResp.builder() | ||||||
|   | |||||||
| @@ -86,7 +86,7 @@ public class UserController extends BaseController<UserService, UserResp, UserDe | |||||||
|     @Operation(summary = "解析导入数据", description = "解析导入数据") |     @Operation(summary = "解析导入数据", description = "解析导入数据") | ||||||
|     @SaCheckPermission("system:user:import") |     @SaCheckPermission("system:user:import") | ||||||
|     @PostMapping("/import/parse") |     @PostMapping("/import/parse") | ||||||
|     public UserImportParseResp parseImport(@NotNull(message = "文件不能为空") MultipartFile file) { |     public UserImportParseResp parseImport(@NotNull(message = "文件不能为空") @RequestPart MultipartFile file) { | ||||||
|         ValidationUtils.throwIf(file::isEmpty, "文件不能为空"); |         ValidationUtils.throwIf(file::isEmpty, "文件不能为空"); | ||||||
|         return baseService.parseImport(file); |         return baseService.parseImport(file); | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user