mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-11 06:57:12 +08:00
fix(system/file): 补充文件管理校验注解
This commit is contained in:
@@ -41,8 +41,8 @@ public class FileReq implements Serializable {
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "名称", example = "example")
|
||||
@NotBlank(message = "文件名称不能为空")
|
||||
@Length(max = 255, message = "文件名称长度不能超过 {max} 个字符")
|
||||
@NotBlank(message = "名称不能为空")
|
||||
@Length(max = 255, message = "名称长度不能超过 {max} 个字符")
|
||||
private String originalName;
|
||||
|
||||
/**
|
||||
|
@@ -19,6 +19,7 @@ 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.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.x.file.storage.core.FileInfo;
|
||||
@@ -81,7 +82,8 @@ public class FileController extends BaseController<FileService, FileResp, FileRe
|
||||
@Operation(summary = "创建文件夹", description = "创建文件夹")
|
||||
@SaCheckPermission("system:file:createDir")
|
||||
@PostMapping("/dir")
|
||||
public IdResp<Long> createDir(@RequestBody FileReq req) {
|
||||
public IdResp<Long> createDir(@Valid @RequestBody FileReq req) {
|
||||
ValidationUtils.throwIfBlank(req.getParentPath(), "上级目录不能为空");
|
||||
return new IdResp<>(baseService.createDir(req));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user