Skip to content

Commit e099b5e

Browse files
committed
fix(system/file): 补充文件管理校验注解
1 parent 0331d4b commit e099b5e

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

  • continew-module-system/src/main/java/top/continew/admin/system/model/req
  • continew-webapi/src/main/java/top/continew/admin/controller/system

continew-module-system/src/main/java/top/continew/admin/system/model/req/FileReq.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public class FileReq implements Serializable {
4141
* 名称
4242
*/
4343
@Schema(description = "名称", example = "example")
44-
@NotBlank(message = "文件名称不能为空")
45-
@Length(max = 255, message = "文件名称长度不能超过 {max} 个字符")
44+
@NotBlank(message = "名称不能为空")
45+
@Length(max = 255, message = "名称长度不能超过 {max} 个字符")
4646
private String originalName;
4747

4848
/**

continew-webapi/src/main/java/top/continew/admin/controller/system/FileController.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import cn.dev33.satoken.annotation.SaCheckPermission;
2020
import io.swagger.v3.oas.annotations.Operation;
2121
import io.swagger.v3.oas.annotations.tags.Tag;
22+
import jakarta.validation.Valid;
2223
import jakarta.validation.constraints.NotNull;
2324
import lombok.RequiredArgsConstructor;
2425
import org.dromara.x.file.storage.core.FileInfo;
@@ -81,7 +82,8 @@ public FileUploadResp upload(@NotNull(message = "文件不能为空") MultipartF
8182
@Operation(summary = "创建文件夹", description = "创建文件夹")
8283
@SaCheckPermission("system:file:createDir")
8384
@PostMapping("/dir")
84-
public IdResp<Long> createDir(@RequestBody FileReq req) {
85+
public IdResp<Long> createDir(@Valid @RequestBody FileReq req) {
86+
ValidationUtils.throwIfBlank(req.getParentPath(), "上级目录不能为空");
8587
return new IdResp<>(baseService.createDir(req));
8688
}
8789

0 commit comments

Comments
 (0)