farm模块-批量上传实体类
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.file.vo.file;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.AssertTrue;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 多文件上传 Request VO")
|
||||
@Data
|
||||
public class FileMultiUploadReqVO {
|
||||
|
||||
@Schema(description = "文件附件列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "文件附件列表不能为空")
|
||||
@Size(max = 10, message = "最多只能上传10个文件")
|
||||
private List<MultipartFile> files;
|
||||
|
||||
@Schema(description = "文件目录", example = "XXX/YYY")
|
||||
private String directory;
|
||||
|
||||
@AssertTrue(message = "文件目录不正确")
|
||||
@JsonIgnore
|
||||
public boolean isDirectoryValid() {
|
||||
return !StrUtil.containsAny(directory, "..", "/", "\\");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.file.vo.file;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 多文件上传 Response VO")
|
||||
@Data
|
||||
public class FileMultiUploadRespVO {
|
||||
|
||||
@Schema(description = "上传成功的文件列表")
|
||||
private List<FileUploadResult> successFiles;
|
||||
|
||||
@Schema(description = "上传失败的文件列表")
|
||||
private List<FileUploadResult> failedFiles;
|
||||
|
||||
@Schema(description = "总文件数")
|
||||
private Integer totalCount;
|
||||
|
||||
@Schema(description = "成功数量")
|
||||
private Integer successCount;
|
||||
|
||||
@Schema(description = "失败数量")
|
||||
private Integer failedCount;
|
||||
|
||||
@Schema(description = "管理后台 - 文件上传结果")
|
||||
@Data
|
||||
public static class FileUploadResult {
|
||||
|
||||
@Schema(description = "原始文件名")
|
||||
private String originalName;
|
||||
|
||||
@Schema(description = "文件访问路径")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "文件大小(字节)")
|
||||
private Long size;
|
||||
|
||||
@Schema(description = "文件类型")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "错误信息")
|
||||
private String errorMessage;
|
||||
|
||||
@Schema(description = "是否上传成功")
|
||||
private Boolean success;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user