mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-10 20:57:14 +08:00
chore: 补充文件上传相关接口的文档参数注解
This commit is contained in:
@@ -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()
|
||||
|
@@ -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()
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user