Commit bfff8f5ec43656a3487a6c04a911115ea6a71f88
1 parent
a86b5830
feat:【infra】文件上传的 swagger 参数的配置
Showing
2 changed files
with
6 additions
and
0 deletions
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
| ... | ... | @@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.infra.service.file.FileService; |
| 13 | 13 | import io.swagger.v3.oas.annotations.Operation; |
| 14 | 14 | import io.swagger.v3.oas.annotations.Parameter; |
| 15 | 15 | import io.swagger.v3.oas.annotations.Parameters; |
| 16 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 16 | 17 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 17 | 18 | import jakarta.annotation.Resource; |
| 18 | 19 | import jakarta.annotation.security.PermitAll; |
| ... | ... | @@ -44,6 +45,8 @@ public class FileController { |
| 44 | 45 | |
| 45 | 46 | @PostMapping("/upload") |
| 46 | 47 | @Operation(summary = "上传文件", description = "模式一:后端上传文件") |
| 48 | + @Parameter(name = "file", description = "文件附件", required = true, | |
| 49 | + schema = @Schema(type = "string", format = "binary")) | |
| 47 | 50 | public CommonResult<String> uploadFile(@Valid FileUploadReqVO uploadReqVO) throws Exception { |
| 48 | 51 | MultipartFile file = uploadReqVO.getFile(); |
| 49 | 52 | byte[] content = IoUtil.readBytes(file.getInputStream()); | ... | ... |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/AppFileController.java
| ... | ... | @@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.infra.service.file.FileService; |
| 9 | 9 | import io.swagger.v3.oas.annotations.Operation; |
| 10 | 10 | import io.swagger.v3.oas.annotations.Parameter; |
| 11 | 11 | import io.swagger.v3.oas.annotations.Parameters; |
| 12 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 12 | 13 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 13 | 14 | import jakarta.annotation.Resource; |
| 14 | 15 | import jakarta.annotation.security.PermitAll; |
| ... | ... | @@ -32,6 +33,8 @@ public class AppFileController { |
| 32 | 33 | |
| 33 | 34 | @PostMapping("/upload") |
| 34 | 35 | @Operation(summary = "上传文件") |
| 36 | + @Parameter(name = "file", description = "文件附件", required = true, | |
| 37 | + schema = @Schema(type = "string", format = "binary")) | |
| 35 | 38 | @PermitAll |
| 36 | 39 | public CommonResult<String> uploadFile(AppFileUploadReqVO uploadReqVO) throws Exception { |
| 37 | 40 | MultipartFile file = uploadReqVO.getFile(); | ... | ... |