From 5a9958c36cdafc5b27de580a5f11a59319818904 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Wed, 21 May 2025 22:26:30 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E8=A1=A5=E5=85=85=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=E7=9A=84?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E5=8F=82=E6=95=B0=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/common/CommonController.java | 5 +++-- .../continew/admin/controller/system/FileController.java | 9 ++++++--- .../continew/admin/controller/system/UserController.java | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/continew-webapi/src/main/java/top/continew/admin/controller/common/CommonController.java b/continew-webapi/src/main/java/top/continew/admin/controller/common/CommonController.java index 838c5e78..e42aea6f 100644 --- a/continew-webapi/src/main/java/top/continew/admin/controller/common/CommonController.java +++ b/continew-webapi/src/main/java/top/continew/admin/controller/common/CommonController.java @@ -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() diff --git a/continew-webapi/src/main/java/top/continew/admin/controller/system/FileController.java b/continew-webapi/src/main/java/top/continew/admin/controller/system/FileController.java index 3de6a87e..03db9d3e 100644 --- a/continew-webapi/src/main/java/top/continew/admin/controller/system/FileController.java +++ b/continew-webapi/src/main/java/top/continew/admin/controller/system/FileController.java @@ -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