mirror of
https://gitee.com/lxp135/minio-plus.git
synced 2025-12-06 17:08:26 +08:00
升级 Knife4j 到 OpenAPI3 版本,为同时兼容 Springboot2 和 Springboot3 做准备。
This commit is contained in:
parent
4de6b0679d
commit
ea987d881c
@ -17,14 +17,9 @@
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
<!--Swagger工具包 knife4j -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-annotations</artifactId>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/io.swagger/swagger-annotations -->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package org.liuxp.minioplus.api.model.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
@ -16,22 +16,22 @@ import lombok.ToString;
|
||||
@ToString
|
||||
public class FileMetadataInfoDTO {
|
||||
|
||||
@ApiModelProperty("文件KEY")
|
||||
@Schema(description = "文件KEY")
|
||||
private String fileKey;
|
||||
|
||||
@ApiModelProperty("文件md5")
|
||||
@Schema(description = "文件md5")
|
||||
private String fileMd5;
|
||||
|
||||
@ApiModelProperty("存储桶")
|
||||
@Schema(description = "存储桶")
|
||||
private String bucket;
|
||||
|
||||
@ApiModelProperty("是否私有 false:否 true:是")
|
||||
@Schema(description = "是否私有 false:否 true:是")
|
||||
private Boolean isPrivate;
|
||||
|
||||
@ApiModelProperty("状态 false:未完成 true:已完成")
|
||||
@Schema(description = "状态 false:未完成 true:已完成")
|
||||
private Boolean isFinished;
|
||||
|
||||
@ApiModelProperty("创建人")
|
||||
@Schema(description = "创建人")
|
||||
private String createUser;
|
||||
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
package org.liuxp.minioplus.api.model.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
@ -15,89 +14,89 @@ import lombok.ToString;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@ApiModel("文件元数据信息保存入参")
|
||||
@Schema(description = "文件元数据信息保存入参")
|
||||
public class FileMetadataInfoSaveDTO {
|
||||
/**
|
||||
* 文件KEY
|
||||
*/
|
||||
@ApiModelProperty("文件KEY")
|
||||
@Schema(description = "文件KEY")
|
||||
private String fileKey;
|
||||
/**
|
||||
* 文件md5
|
||||
*/
|
||||
@ApiModelProperty("文件md5")
|
||||
@Schema(description = "文件md5")
|
||||
private String fileMd5;
|
||||
/**
|
||||
* 文件名
|
||||
*/
|
||||
@ApiModelProperty("文件名")
|
||||
@Schema(description = "文件名")
|
||||
private String fileName;
|
||||
/**
|
||||
* MIME类型
|
||||
*/
|
||||
@ApiModelProperty("MIME类型")
|
||||
@Schema(description = "MIME类型")
|
||||
private String fileMimeType;
|
||||
/**
|
||||
* 文件后缀
|
||||
*/
|
||||
@ApiModelProperty("文件后缀")
|
||||
@Schema(description = "文件后缀")
|
||||
private String fileSuffix;
|
||||
/**
|
||||
* 文件长度
|
||||
*/
|
||||
@ApiModelProperty("文件长度")
|
||||
@Schema(description = "文件长度")
|
||||
private Long fileSize;
|
||||
/**
|
||||
* 存储桶
|
||||
*/
|
||||
@ApiModelProperty("存储桶")
|
||||
@Schema(description = "存储桶")
|
||||
private String storageBucket;
|
||||
/**
|
||||
* 存储路径
|
||||
*/
|
||||
@ApiModelProperty("存储路径")
|
||||
@Schema(description = "存储路径")
|
||||
private String storagePath;
|
||||
|
||||
/**
|
||||
* 上传任务id,用于合并切片
|
||||
*/
|
||||
@ApiModelProperty("上传任务id,用于合并切片")
|
||||
@Schema(description = "上传任务id,用于合并切片")
|
||||
private String uploadTaskId;
|
||||
/**
|
||||
* 状态 0:未完成 1:已完成
|
||||
*/
|
||||
@ApiModelProperty("状态 false:未完成 true:已完成")
|
||||
@Schema(description = "状态 false:未完成 true:已完成")
|
||||
private Boolean isFinished;
|
||||
/**
|
||||
* 是否分块 0:否 1:是
|
||||
*/
|
||||
@ApiModelProperty("是否分块 false:否 true:是")
|
||||
@Schema(description = "是否分块 false:否 true:是")
|
||||
private Boolean isPart;
|
||||
/**
|
||||
* 分块数量
|
||||
*/
|
||||
@ApiModelProperty("分块数量")
|
||||
@Schema(description = "分块数量")
|
||||
private Integer partNumber;
|
||||
/**
|
||||
* 预览图 0:无 1:有
|
||||
*/
|
||||
@ApiModelProperty("预览图 false:无 true:有")
|
||||
@Schema(description = "预览图 false:无 true:有")
|
||||
private Boolean isPreview;
|
||||
/**
|
||||
* 是否私有 0:否 1:是
|
||||
*/
|
||||
@ApiModelProperty("是否私有 false:否 true:是")
|
||||
@Schema(description = "是否私有 false:否 true:是")
|
||||
private Boolean isPrivate;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@ApiModelProperty("创建人")
|
||||
@Schema(description = "创建人")
|
||||
private String createUser;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@ApiModelProperty("修改人")
|
||||
@Schema(description = "修改人")
|
||||
private String updateUser;
|
||||
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
package org.liuxp.minioplus.api.model.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
@ -14,58 +13,58 @@ import lombok.ToString;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@ApiModel("文件元数据信息修改入参")
|
||||
@Schema(description = "文件元数据信息修改入参")
|
||||
public class FileMetadataInfoUpdateDTO {
|
||||
|
||||
@ApiModelProperty("主键")
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("文件KEY")
|
||||
@Schema(description = "文件KEY")
|
||||
private String fileKey;
|
||||
|
||||
@ApiModelProperty("文件md5")
|
||||
@Schema(description = "文件md5")
|
||||
private String fileMd5;
|
||||
|
||||
@ApiModelProperty("文件名")
|
||||
@Schema(description = "文件名")
|
||||
private String fileName;
|
||||
|
||||
@ApiModelProperty("MIME类型")
|
||||
@Schema(description = "MIME类型")
|
||||
private String fileMimeType;
|
||||
|
||||
@ApiModelProperty("文件后缀")
|
||||
@Schema(description = "文件后缀")
|
||||
private String fileSuffix;
|
||||
|
||||
@ApiModelProperty("文件长度")
|
||||
@Schema(description = "文件长度")
|
||||
private Long fileSize;
|
||||
|
||||
@ApiModelProperty("存储引擎")
|
||||
@Schema(description = "存储引擎")
|
||||
private String storageEngine;
|
||||
|
||||
@ApiModelProperty("存储桶")
|
||||
@Schema(description = "存储桶")
|
||||
private String storageBucket;
|
||||
|
||||
@ApiModelProperty("存储路径")
|
||||
@Schema(description = "存储路径")
|
||||
private String storagePath;
|
||||
|
||||
@ApiModelProperty("上传任务id,用于合并切片")
|
||||
@Schema(description = "上传任务id,用于合并切片")
|
||||
private String uploadTaskId;
|
||||
|
||||
@ApiModelProperty("状态 false:未完成 true:已完成")
|
||||
@Schema(description = "状态 false:未完成 true:已完成")
|
||||
private Boolean isFinished;
|
||||
|
||||
@ApiModelProperty("是否分块 false:否 true:是")
|
||||
@Schema(description = "是否分块 false:否 true:是")
|
||||
private Boolean isPart;
|
||||
|
||||
@ApiModelProperty("分块数量")
|
||||
@Schema(description = "分块数量")
|
||||
private Integer partNumber;
|
||||
|
||||
@ApiModelProperty("预览图 false:无 true:有")
|
||||
@Schema(description = "预览图 false:无 true:有")
|
||||
private Boolean isPreview;
|
||||
|
||||
@ApiModelProperty("是否私有 false:否 true:是")
|
||||
@Schema(description = "是否私有 false:否 true:是")
|
||||
private Boolean isPrivate;
|
||||
|
||||
@ApiModelProperty("修改人")
|
||||
@Schema(description = "修改人")
|
||||
private String updateUser;
|
||||
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
package org.liuxp.minioplus.api.model.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -16,16 +15,16 @@ import java.util.List;
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel("文件完整性校验结果")
|
||||
@Schema(description = "文件完整性校验结果")
|
||||
public class CompleteResultVo {
|
||||
|
||||
@ApiModelProperty("是否完成")
|
||||
@Schema(description = "是否完成")
|
||||
private Boolean isComplete;
|
||||
|
||||
@ApiModelProperty("上传任务编号")
|
||||
@Schema(description = "上传任务编号")
|
||||
private String uploadTaskId;
|
||||
|
||||
@ApiModelProperty("补传的分块信息")
|
||||
@Schema(description = "补传的分块信息")
|
||||
private List<FileCheckResultVo.Part> partList = new ArrayList<>();
|
||||
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
package org.liuxp.minioplus.api.model.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -16,65 +15,65 @@ import java.util.List;
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel("文件初始化结果")
|
||||
@Schema(description = "文件初始化结果")
|
||||
public class FileCheckResultVo {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
/**
|
||||
* 文件KEY
|
||||
*/
|
||||
@ApiModelProperty("文件KEY")
|
||||
@Schema(description = "文件KEY")
|
||||
private String fileKey;
|
||||
/**
|
||||
* 文件md5
|
||||
*/
|
||||
@ApiModelProperty("文件md5")
|
||||
@Schema(description = "文件md5")
|
||||
private String fileMd5;
|
||||
/**
|
||||
* 文件名
|
||||
*/
|
||||
@ApiModelProperty("文件名")
|
||||
@Schema(description = "文件名")
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* MIME类型
|
||||
*/
|
||||
@ApiModelProperty("MIME类型")
|
||||
@Schema(description = "MIME类型")
|
||||
private String fileMimeType;
|
||||
/**
|
||||
* 文件后缀
|
||||
*/
|
||||
@ApiModelProperty("文件后缀")
|
||||
@Schema(description = "文件后缀")
|
||||
private String fileSuffix;
|
||||
/**
|
||||
* 文件长度
|
||||
*/
|
||||
@ApiModelProperty("文件长度")
|
||||
@Schema(description = "文件长度")
|
||||
private Long fileSize;
|
||||
/**
|
||||
* 是否秒传
|
||||
*/
|
||||
@ApiModelProperty("是否秒传")
|
||||
@Schema(description = "是否秒传")
|
||||
private Boolean isDone;
|
||||
/**
|
||||
* 分块数量
|
||||
*/
|
||||
@ApiModelProperty("分块数量")
|
||||
@Schema(description = "分块数量")
|
||||
private Integer partCount;
|
||||
|
||||
/**
|
||||
* 分块大小
|
||||
*/
|
||||
@ApiModelProperty("分块大小")
|
||||
@Schema(description = "分块大小")
|
||||
private Integer partSize;
|
||||
|
||||
/**
|
||||
* 分块信息
|
||||
*/
|
||||
@ApiModelProperty("分块信息")
|
||||
@Schema(description = "分块信息")
|
||||
private List<Part> partList = new ArrayList<>();
|
||||
|
||||
@Getter
|
||||
@ -83,22 +82,22 @@ public class FileCheckResultVo {
|
||||
/**
|
||||
* minio的上传id
|
||||
*/
|
||||
@ApiModelProperty("minio的上传id")
|
||||
@Schema(description = "minio的上传id")
|
||||
private String uploadId;
|
||||
/**
|
||||
* 上传地址
|
||||
*/
|
||||
@ApiModelProperty("上传地址")
|
||||
@Schema(description = "上传地址")
|
||||
private String url;
|
||||
/**
|
||||
* 开始位置
|
||||
*/
|
||||
@ApiModelProperty("开始位置")
|
||||
@Schema(description = "开始位置")
|
||||
private Long startPosition;
|
||||
/**
|
||||
* 结束位置
|
||||
*/
|
||||
@ApiModelProperty("结束位置")
|
||||
@Schema(description = "结束位置")
|
||||
private Long endPosition;
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package org.liuxp.minioplus.api.model.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -15,67 +14,67 @@ import java.util.Date;
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel("文件元数据信息")
|
||||
@Schema(description = "文件元数据信息")
|
||||
public class FileMetadataInfoVo {
|
||||
|
||||
@ApiModelProperty("主键")
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("文件KEY")
|
||||
@Schema(description = "文件KEY")
|
||||
private String fileKey;
|
||||
|
||||
@ApiModelProperty("文件md5")
|
||||
@Schema(description = "文件md5")
|
||||
private String fileMd5;
|
||||
|
||||
@ApiModelProperty("文件名")
|
||||
@Schema(description = "文件名")
|
||||
private String fileName;
|
||||
|
||||
@ApiModelProperty("MIME类型")
|
||||
@Schema(description = "MIME类型")
|
||||
private String fileMimeType;
|
||||
|
||||
@ApiModelProperty("文件后缀")
|
||||
@Schema(description = "文件后缀")
|
||||
private String fileSuffix;
|
||||
|
||||
@ApiModelProperty("文件长度")
|
||||
@Schema(description = "文件长度")
|
||||
private Long fileSize;
|
||||
|
||||
@ApiModelProperty("存储引擎")
|
||||
@Schema(description = "存储引擎")
|
||||
private String storageEngine;
|
||||
|
||||
@ApiModelProperty("存储桶")
|
||||
@Schema(description = "存储桶")
|
||||
private String storageBucket;
|
||||
|
||||
@ApiModelProperty("存储路径")
|
||||
@Schema(description = "存储路径")
|
||||
private String storagePath;
|
||||
|
||||
@ApiModelProperty("minio切片任务id")
|
||||
@Schema(description = "minio切片任务id")
|
||||
private String uploadTaskId;
|
||||
|
||||
@ApiModelProperty("状态 0:未完成 1:已完成")
|
||||
@Schema(description = "状态 0:未完成 1:已完成")
|
||||
private Boolean isFinished;
|
||||
|
||||
@ApiModelProperty("是否分块 0:否 1:是")
|
||||
@Schema(description = "是否分块 0:否 1:是")
|
||||
private Boolean isPart;
|
||||
|
||||
@ApiModelProperty("分块数量")
|
||||
@Schema(description = "分块数量")
|
||||
private Integer partNumber;
|
||||
|
||||
@ApiModelProperty("预览图 0:无 1:有")
|
||||
@Schema(description = "预览图 0:无 1:有")
|
||||
private Boolean isPreview;
|
||||
|
||||
@ApiModelProperty("是否私有 0:否 1:是")
|
||||
@Schema(description = "是否私有 0:否 1:是")
|
||||
private Boolean isPrivate;
|
||||
|
||||
@ApiModelProperty("创建人")
|
||||
@Schema(description = "创建人")
|
||||
private String createUser;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("修改人")
|
||||
@Schema(description = "修改人")
|
||||
private String updateUser;
|
||||
|
||||
@ApiModelProperty("修改时间")
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
package org.liuxp.minioplus.api.model.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -15,31 +14,31 @@ import java.util.List;
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel("文件预分片结果")
|
||||
@Schema(description = "文件预分片结果")
|
||||
public class FilePreShardingVo {
|
||||
|
||||
/**
|
||||
* 文件长度
|
||||
*/
|
||||
@ApiModelProperty("文件长度")
|
||||
@Schema(description = "文件长度")
|
||||
private Long fileSize;
|
||||
|
||||
/**
|
||||
* 分块数量
|
||||
*/
|
||||
@ApiModelProperty("分块数量")
|
||||
@Schema(description = "分块数量")
|
||||
private Integer partCount;
|
||||
|
||||
/**
|
||||
* 分块大小
|
||||
*/
|
||||
@ApiModelProperty("分块大小")
|
||||
@Schema(description = "分块大小")
|
||||
private Integer partSize;
|
||||
|
||||
/**
|
||||
* 分块信息
|
||||
*/
|
||||
@ApiModelProperty("分块信息")
|
||||
@Schema(description = "分块信息")
|
||||
private List<Part> partList = new ArrayList<>();
|
||||
|
||||
@Getter
|
||||
@ -49,12 +48,12 @@ public class FilePreShardingVo {
|
||||
/**
|
||||
* 开始位置
|
||||
*/
|
||||
@ApiModelProperty("开始位置")
|
||||
@Schema(description = "开始位置")
|
||||
private Long startPosition;
|
||||
/**
|
||||
* 结束位置
|
||||
*/
|
||||
@ApiModelProperty("结束位置")
|
||||
@Schema(description = "结束位置")
|
||||
private Long endPosition;
|
||||
|
||||
}
|
||||
|
||||
@ -16,17 +16,15 @@
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>minio-plus-all-spring-boot-starter</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>s3-api-minio</artifactId>
|
||||
</dependency>
|
||||
<!--Swagger工具包 knife4j -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter -->
|
||||
<dependency>
|
||||
@ -41,11 +39,6 @@
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.11.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@ -5,15 +5,16 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 标准版示例工程启动类
|
||||
* Springboot2
|
||||
* @author contact@liuxp.me
|
||||
* @since 2024-05-22
|
||||
*/
|
||||
|
||||
@SpringBootApplication
|
||||
public class OfficialApplication {
|
||||
public class MinioPlusSpringboot2Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(OfficialApplication.class, args);
|
||||
SpringApplication.run(MinioPlusSpringboot2Application.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
package org.liuxp.minioplus.application.common;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
|
||||
|
||||
/**
|
||||
* 接口文档配置
|
||||
* @author : contact@liuxp.me
|
||||
* @since 2024/6/18
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2WebMvc
|
||||
public class SwaggerConfig {
|
||||
|
||||
@Bean(value = "dockerBean")
|
||||
public Docket dockerBean() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("org.liuxp.minioplus.extension.controller"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("MinIO Plus API 文档")
|
||||
.contact(new Contact("刘小平", "https://liuxp.me", "contact@liuxp.me"))
|
||||
.version("1.0.0")
|
||||
.description("MinIO-Plus 是一个 MinIO 的二次封装与增强工具,在 MinIO 的基础上只做增强,不侵入 MinIO 代码,只为简化开发、提高效率而生。成为 MinIO 在项目中落地的润滑剂。")
|
||||
.license("The Apache License, Version 2.0")
|
||||
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
@ -23,78 +23,78 @@ import java.util.Date;
|
||||
public class FileMetadataInfoEntity {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty("主键")
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("文件KEY")
|
||||
@Schema(description = "文件KEY")
|
||||
@TableField(value = "file_key")
|
||||
private String fileKey;
|
||||
|
||||
@ApiModelProperty("文件md5")
|
||||
@Schema(description = "文件md5")
|
||||
@TableField(value = "file_md5")
|
||||
private String fileMd5;
|
||||
|
||||
@ApiModelProperty("文件名")
|
||||
@Schema(description = "文件名")
|
||||
@TableField(value = "file_name")
|
||||
private String fileName;
|
||||
|
||||
@ApiModelProperty("MIME类型")
|
||||
@Schema(description = "MIME类型")
|
||||
@TableField(value = "file_mime_type")
|
||||
private String fileMimeType;
|
||||
|
||||
@ApiModelProperty("文件后缀")
|
||||
@Schema(description = "文件后缀")
|
||||
@TableField(value = "file_suffix")
|
||||
private String fileSuffix;
|
||||
|
||||
@ApiModelProperty("文件长度")
|
||||
@Schema(description = "文件长度")
|
||||
@TableField(value = "file_size")
|
||||
private Long fileSize;
|
||||
|
||||
@ApiModelProperty("预览图 0:无 1:有")
|
||||
@Schema(description = "预览图 0:无 1:有")
|
||||
@TableField(value = "is_preview")
|
||||
private Boolean isPreview;
|
||||
|
||||
@ApiModelProperty("是否私有 0:否 1:是")
|
||||
@Schema(description = "是否私有 0:否 1:是")
|
||||
@TableField(value = "is_private")
|
||||
private Boolean isPrivate;
|
||||
|
||||
@ApiModelProperty("存储桶")
|
||||
@Schema(description = "存储桶")
|
||||
@TableField(value = "bucket")
|
||||
private String storageBucket;
|
||||
|
||||
@ApiModelProperty("存储桶路径")
|
||||
@Schema(description = "存储桶路径")
|
||||
@TableField(value = "bucket_path")
|
||||
private String storagePath;
|
||||
|
||||
@ApiModelProperty("上传任务id,用于合并切片")
|
||||
@Schema(description = "上传任务id,用于合并切片")
|
||||
@TableField(value = "upload_id")
|
||||
private String uploadTaskId;
|
||||
|
||||
@ApiModelProperty("状态 0:未完成 1:已完成")
|
||||
@Schema(description = "状态 0:未完成 1:已完成")
|
||||
@TableField(value = "is_finished")
|
||||
private Boolean isFinished;
|
||||
|
||||
@ApiModelProperty("是否分块 0:否 1:是")
|
||||
@Schema(description = "是否分块 0:否 1:是")
|
||||
@TableField(value = "is_part")
|
||||
private Boolean isPart;
|
||||
|
||||
@ApiModelProperty("分块数量")
|
||||
@Schema(description = "分块数量")
|
||||
@TableField(value = "part_number")
|
||||
private Integer partNumber;
|
||||
|
||||
@ApiModelProperty("创建人")
|
||||
@Schema(description = "创建人")
|
||||
@TableField("create_user")
|
||||
private String createUser;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
@Schema(description = "创建时间")
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("修改人")
|
||||
@Schema(description = "修改人")
|
||||
@TableField("update_user")
|
||||
private String updateUser;
|
||||
|
||||
@ApiModelProperty("修改时间")
|
||||
@Schema(description = "修改时间")
|
||||
@TableField("update_time")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
@ -31,6 +31,25 @@ spring:
|
||||
#密码
|
||||
password: ${DB_PASSWORD:dkjlasd94934#!}
|
||||
##################################################################
|
||||
# springdoc-openapi项目配置
|
||||
##################################################################
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html
|
||||
tags-sorter: alpha
|
||||
operations-sorter: alpha
|
||||
api-docs:
|
||||
path: /v3/api-docs
|
||||
group-configs:
|
||||
- group: 'default'
|
||||
paths-to-match: '/**'
|
||||
packages-to-scan: org.liuxp.minioplus.extension.controller
|
||||
# knife4j的增强配置,不需要增强可以不配
|
||||
knife4j:
|
||||
enable: true
|
||||
setting:
|
||||
language: zh_cn
|
||||
##################################################################
|
||||
# 日志配置
|
||||
##################################################################
|
||||
logging:
|
||||
|
||||
@ -17,6 +17,10 @@
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>minio-plus-core-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>s3-api-minio</artifactId>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
@ -30,11 +34,6 @@
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.11.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
@ -23,78 +23,78 @@ import java.util.Date;
|
||||
public class FileMetadataInfoEntity {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty("主键")
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("文件KEY")
|
||||
@Schema(description = "文件KEY")
|
||||
@TableField(value = "file_key")
|
||||
private String fileKey;
|
||||
|
||||
@ApiModelProperty("文件md5")
|
||||
@Schema(description = "文件md5")
|
||||
@TableField(value = "file_md5")
|
||||
private String fileMd5;
|
||||
|
||||
@ApiModelProperty("文件名")
|
||||
@Schema(description = "文件名")
|
||||
@TableField(value = "file_name")
|
||||
private String fileName;
|
||||
|
||||
@ApiModelProperty("MIME类型")
|
||||
@Schema(description = "MIME类型")
|
||||
@TableField(value = "file_mime_type")
|
||||
private String fileMimeType;
|
||||
|
||||
@ApiModelProperty("文件后缀")
|
||||
@Schema(description = "文件后缀")
|
||||
@TableField(value = "file_suffix")
|
||||
private String fileSuffix;
|
||||
|
||||
@ApiModelProperty("文件长度")
|
||||
@Schema(description = "文件长度")
|
||||
@TableField(value = "file_size")
|
||||
private Long fileSize;
|
||||
|
||||
@ApiModelProperty("预览图 0:无 1:有")
|
||||
@Schema(description = "预览图 0:无 1:有")
|
||||
@TableField(value = "is_preview")
|
||||
private Boolean isPreview;
|
||||
|
||||
@ApiModelProperty("是否私有 0:否 1:是")
|
||||
@Schema(description = "是否私有 0:否 1:是")
|
||||
@TableField(value = "is_private")
|
||||
private Boolean isPrivate;
|
||||
|
||||
@ApiModelProperty("存储桶")
|
||||
@Schema(description = "存储桶")
|
||||
@TableField(value = "bucket")
|
||||
private String storageBucket;
|
||||
|
||||
@ApiModelProperty("存储桶路径")
|
||||
@Schema(description = "存储桶路径")
|
||||
@TableField(value = "bucket_path")
|
||||
private String storagePath;
|
||||
|
||||
@ApiModelProperty("上传任务id,用于合并切片")
|
||||
@Schema(description = "上传任务id,用于合并切片")
|
||||
@TableField(value = "upload_id")
|
||||
private String uploadTaskId;
|
||||
|
||||
@ApiModelProperty("状态 0:未完成 1:已完成")
|
||||
@Schema(description = "状态 0:未完成 1:已完成")
|
||||
@TableField(value = "is_finished")
|
||||
private Boolean isFinished;
|
||||
|
||||
@ApiModelProperty("是否分块 0:否 1:是")
|
||||
@Schema(description = "是否分块 0:否 1:是")
|
||||
@TableField(value = "is_part")
|
||||
private Boolean isPart;
|
||||
|
||||
@ApiModelProperty("分块数量")
|
||||
@Schema(description = "分块数量")
|
||||
@TableField(value = "part_number")
|
||||
private Integer partNumber;
|
||||
|
||||
@ApiModelProperty("创建人")
|
||||
@Schema(description = "创建人")
|
||||
@TableField("create_user")
|
||||
private String createUser;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
@Schema(description = "创建时间")
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("修改人")
|
||||
@Schema(description = "修改人")
|
||||
@TableField("update_user")
|
||||
private String updateUser;
|
||||
|
||||
@ApiModelProperty("修改时间")
|
||||
@Schema(description = "修改时间")
|
||||
@TableField("update_time")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>minio-plus-application</artifactId>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>minio-plus-application-springboot3</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>minio-plus-all-springboot3-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>s3-api-minio</artifactId>
|
||||
</dependency>
|
||||
<!--Swagger工具包 knife4j -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,20 @@
|
||||
package org.liuxp.minioplus.application;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 标准版示例工程启动类
|
||||
* Springboot3
|
||||
* @author contact@liuxp.me
|
||||
* @since 2024-05-22
|
||||
*/
|
||||
|
||||
@SpringBootApplication
|
||||
public class MinioPlusSpringboot3Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MinioPlusSpringboot3Application.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
package org.liuxp.minioplus.application.common;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.liuxp.minioplus.extension.context.UserHolder;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 登录用户拦截器
|
||||
*
|
||||
* @author contact@liuxp.me
|
||||
* @since 2024/06/11
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class LoginUserInterceptor implements HandlerInterceptor {
|
||||
|
||||
/**
|
||||
* 处理登录用户信息
|
||||
*
|
||||
* @param request 请求
|
||||
* @param response 返回
|
||||
* @param handler 要执行的处理程序
|
||||
* @return 是否继续执行下一个拦截器
|
||||
*/
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, @Nonnull HttpServletResponse response, @Nonnull Object handler) {
|
||||
String userId = request.getHeader("Authorization");
|
||||
if(CharSequenceUtil.isBlank(userId)){
|
||||
UserHolder.set("");
|
||||
}else{
|
||||
UserHolder.set(userId);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理资源
|
||||
*
|
||||
* @param request 请求
|
||||
* @param response 返回
|
||||
* @param handler 要执行的处理程序
|
||||
* @param exception 异常信息
|
||||
*/
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable Exception exception) {
|
||||
log.debug("Project ThreadLocal 清理之前:{}", UserHolder.get());
|
||||
UserHolder.clean();
|
||||
log.debug("Project ThreadLocal 清理之之后:{}", UserHolder.get());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package org.liuxp.minioplus.application.common;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* SpringMVC配置
|
||||
* @author contact@liuxp.me
|
||||
* @since 2024/06/11
|
||||
*/
|
||||
@Configuration
|
||||
public class WebMvcConfig implements WebMvcConfigurer {
|
||||
|
||||
@Resource
|
||||
private LoginUserInterceptor loginUserInterceptor;
|
||||
|
||||
/**
|
||||
* 前置拦截器
|
||||
*/
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 登录用户
|
||||
registry.addInterceptor(loginUserInterceptor).addPathPatterns("/storage/**");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,119 @@
|
||||
package org.liuxp.minioplus.application.dao;
|
||||
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.liuxp.minioplus.application.entity.FileMetadataInfoEntity;
|
||||
import org.liuxp.minioplus.application.mapper.FileMetadataInfoMapper;
|
||||
import org.liuxp.minioplus.api.model.dto.FileMetadataInfoDTO;
|
||||
import org.liuxp.minioplus.api.model.dto.FileMetadataInfoSaveDTO;
|
||||
import org.liuxp.minioplus.api.model.dto.FileMetadataInfoUpdateDTO;
|
||||
import org.liuxp.minioplus.api.model.vo.FileMetadataInfoVo;
|
||||
import org.liuxp.minioplus.core.repository.MetadataRepository;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文件元数据接口实现类
|
||||
*
|
||||
* @author contact@liuxp.me
|
||||
* @since 2024/05/22
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MetadataRepositoryImpl extends ServiceImpl<FileMetadataInfoMapper, FileMetadataInfoEntity> implements MetadataRepository {
|
||||
|
||||
@Override
|
||||
public List<FileMetadataInfoVo> list(FileMetadataInfoDTO searchDTO) {
|
||||
|
||||
// 组装查询参数
|
||||
QueryWrapper<FileMetadataInfoEntity> queryWrapper = buildParams(searchDTO);
|
||||
|
||||
List<FileMetadataInfoEntity> fileMetadataInfoEntityList = super.list(queryWrapper);
|
||||
|
||||
List<FileMetadataInfoVo> fileMetadataInfoVoList = new ArrayList<>();
|
||||
|
||||
for (FileMetadataInfoEntity fileMetadataInfoEntity : fileMetadataInfoEntityList) {
|
||||
FileMetadataInfoVo fileMetadataInfoVo = new FileMetadataInfoVo();
|
||||
BeanUtils.copyProperties(fileMetadataInfoEntity, fileMetadataInfoVo);
|
||||
fileMetadataInfoVoList.add(fileMetadataInfoVo);
|
||||
}
|
||||
|
||||
return fileMetadataInfoVoList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileMetadataInfoVo one(FileMetadataInfoDTO searchDTO) {
|
||||
|
||||
// 组装查询参数
|
||||
QueryWrapper<FileMetadataInfoEntity> queryWrapper = buildParams(searchDTO);
|
||||
queryWrapper.last("limit 1");
|
||||
|
||||
FileMetadataInfoEntity fileMetadataInfoEntity = super.getOne(queryWrapper);
|
||||
|
||||
FileMetadataInfoVo fileMetadataInfoVo = new FileMetadataInfoVo();
|
||||
|
||||
if(null!=fileMetadataInfoEntity){
|
||||
BeanUtils.copyProperties(fileMetadataInfoEntity, fileMetadataInfoVo);
|
||||
}
|
||||
|
||||
return fileMetadataInfoVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileMetadataInfoVo save(FileMetadataInfoSaveDTO saveDTO) {
|
||||
|
||||
FileMetadataInfoEntity fileMetadataInfoEntity = new FileMetadataInfoEntity();
|
||||
BeanUtils.copyProperties(saveDTO, fileMetadataInfoEntity);
|
||||
fileMetadataInfoEntity.setCreateTime(new Date());
|
||||
fileMetadataInfoEntity.setUpdateTime(new Date());
|
||||
|
||||
boolean result = super.save(fileMetadataInfoEntity);
|
||||
|
||||
FileMetadataInfoVo fileMetadataInfoVo = new FileMetadataInfoVo();
|
||||
if(result){
|
||||
BeanUtils.copyProperties(fileMetadataInfoEntity, fileMetadataInfoVo);
|
||||
}
|
||||
|
||||
return fileMetadataInfoVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileMetadataInfoVo update(FileMetadataInfoUpdateDTO updateDTO) {
|
||||
|
||||
FileMetadataInfoEntity fileMetadataInfoEntity = new FileMetadataInfoEntity();
|
||||
BeanUtils.copyProperties(updateDTO, fileMetadataInfoEntity);
|
||||
fileMetadataInfoEntity.setUpdateTime(new Date());
|
||||
boolean result = super.updateById(fileMetadataInfoEntity);
|
||||
|
||||
FileMetadataInfoVo fileMetadataInfoVo = new FileMetadataInfoVo();
|
||||
if(result){
|
||||
BeanUtils.copyProperties(fileMetadataInfoEntity, fileMetadataInfoVo);
|
||||
}
|
||||
|
||||
return fileMetadataInfoVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean remove(Long id) {
|
||||
return super.removeById(id);
|
||||
}
|
||||
|
||||
private QueryWrapper<FileMetadataInfoEntity> buildParams(FileMetadataInfoDTO searchDTO){
|
||||
// 组装查询参数
|
||||
QueryWrapper<FileMetadataInfoEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(CharSequenceUtil.isNotBlank(searchDTO.getFileKey()),"file_key",searchDTO.getFileKey());
|
||||
queryWrapper.eq(CharSequenceUtil.isNotBlank(searchDTO.getFileMd5()),"file_md5",searchDTO.getFileMd5());
|
||||
queryWrapper.eq(CharSequenceUtil.isNotBlank(searchDTO.getBucket()),"bucket",searchDTO.getBucket());
|
||||
queryWrapper.eq(null!=searchDTO.getIsPrivate(),"is_private",searchDTO.getIsPrivate());
|
||||
queryWrapper.eq(CharSequenceUtil.isNotBlank(searchDTO.getCreateUser()),"create_user",searchDTO.getCreateUser());
|
||||
|
||||
return queryWrapper;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
package org.liuxp.minioplus.application.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 文件元数据信息表Entity
|
||||
* @author contact@liuxp.me
|
||||
* @since 2024-05-22
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@TableName(value = "file_metadata_info")
|
||||
public class FileMetadataInfoEntity {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "文件KEY")
|
||||
@TableField(value = "file_key")
|
||||
private String fileKey;
|
||||
|
||||
@Schema(description = "文件md5")
|
||||
@TableField(value = "file_md5")
|
||||
private String fileMd5;
|
||||
|
||||
@Schema(description = "文件名")
|
||||
@TableField(value = "file_name")
|
||||
private String fileName;
|
||||
|
||||
@Schema(description = "MIME类型")
|
||||
@TableField(value = "file_mime_type")
|
||||
private String fileMimeType;
|
||||
|
||||
@Schema(description = "文件后缀")
|
||||
@TableField(value = "file_suffix")
|
||||
private String fileSuffix;
|
||||
|
||||
@Schema(description = "文件长度")
|
||||
@TableField(value = "file_size")
|
||||
private Long fileSize;
|
||||
|
||||
@Schema(description = "预览图 0:无 1:有")
|
||||
@TableField(value = "is_preview")
|
||||
private Boolean isPreview;
|
||||
|
||||
@Schema(description = "是否私有 0:否 1:是")
|
||||
@TableField(value = "is_private")
|
||||
private Boolean isPrivate;
|
||||
|
||||
@Schema(description = "存储桶")
|
||||
@TableField(value = "bucket")
|
||||
private String storageBucket;
|
||||
|
||||
@Schema(description = "存储桶路径")
|
||||
@TableField(value = "bucket_path")
|
||||
private String storagePath;
|
||||
|
||||
@Schema(description = "上传任务id,用于合并切片")
|
||||
@TableField(value = "upload_id")
|
||||
private String uploadTaskId;
|
||||
|
||||
@Schema(description = "状态 0:未完成 1:已完成")
|
||||
@TableField(value = "is_finished")
|
||||
private Boolean isFinished;
|
||||
|
||||
@Schema(description = "是否分块 0:否 1:是")
|
||||
@TableField(value = "is_part")
|
||||
private Boolean isPart;
|
||||
|
||||
@Schema(description = "分块数量")
|
||||
@TableField(value = "part_number")
|
||||
private Integer partNumber;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
@TableField("create_user")
|
||||
private String createUser;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
@TableField("update_user")
|
||||
private String updateUser;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
@TableField("update_time")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package org.liuxp.minioplus.application.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.liuxp.minioplus.application.entity.FileMetadataInfoEntity;
|
||||
|
||||
/**
|
||||
* 文件元数据信息表Mapper
|
||||
* @author contact@liuxp.me
|
||||
* @since 2024/05/22
|
||||
*/
|
||||
@Mapper
|
||||
public interface FileMetadataInfoMapper extends BaseMapper<FileMetadataInfoEntity> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : localhost
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 50729 (5.7.29-log)
|
||||
Source Host : localhost:3306
|
||||
Source Schema : minio_plus
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 50729 (5.7.29-log)
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 03/06/2024 13:36:32
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for file_metadata_info
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `file_metadata_info`;
|
||||
CREATE TABLE `file_metadata_info` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`file_key` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文件KEY',
|
||||
`file_md5` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件md5',
|
||||
`file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文件名',
|
||||
`file_mime_type` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'MIME类型',
|
||||
`file_suffix` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件后缀',
|
||||
`file_size` bigint(20) NULL DEFAULT NULL COMMENT '文件大小',
|
||||
`is_preview` tinyint(1) NULL DEFAULT 0 COMMENT '预览图 0:无 1:有',
|
||||
`is_private` tinyint(1) NULL DEFAULT 0 COMMENT '是否私有 0:否 1:是',
|
||||
`bucket` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '存储桶',
|
||||
`bucket_path` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '存储桶路径',
|
||||
`upload_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上传任务id',
|
||||
`is_finished` tinyint(1) NOT NULL DEFAULT 0 COMMENT '状态 0:未完成 1:已完成',
|
||||
`is_part` tinyint(1) NULL DEFAULT NULL COMMENT '是否分块 0:否 1:是',
|
||||
`part_number` int(4) NULL DEFAULT NULL COMMENT '分块数量',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`create_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建用户',
|
||||
`update_time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`update_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新用户',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `INDEX_KEY`(`file_key`) USING BTREE,
|
||||
INDEX `INDEX_MD5`(`file_md5`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文件元数据信息表' ROW_FORMAT = Dynamic;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@ -0,0 +1,91 @@
|
||||
spring:
|
||||
#应用唯一标识
|
||||
application:
|
||||
name: MinIOPlus
|
||||
#配置文件
|
||||
profiles:
|
||||
active: dev
|
||||
# 解决Feign接口名称重复报错问题
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
#jdk proxy
|
||||
aop:
|
||||
proxy-target-class: false
|
||||
auto: false
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
default-property-inclusion: non_null # 全局jackson配置
|
||||
mvc:
|
||||
pathmatch:
|
||||
# Springfox使用的路径匹配是基于AntPathMatcher的,而Spring Boot 2.6.X使用的是PathPatternMatcher所以需要配置此参数
|
||||
matching-strategy: ant_path_matcher
|
||||
#数据源配置
|
||||
datasource:
|
||||
#驱动名称
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
#链接地址
|
||||
url: ${DB_JDBC:jdbc:mysql://192.168.50.141:3306/minio-plus?characterEncoding=UTF-8&useSSL=true&serverTimezone=Asia/Shanghai}
|
||||
#用户名
|
||||
username: ${DB_USERNAME:minio}
|
||||
#密码
|
||||
password: ${DB_PASSWORD:dkjlasd94934#!}
|
||||
##################################################################
|
||||
# springdoc-openapi项目配置
|
||||
##################################################################
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html
|
||||
tags-sorter: alpha
|
||||
operations-sorter: alpha
|
||||
api-docs:
|
||||
path: /v3/api-docs
|
||||
group-configs:
|
||||
- group: 'default'
|
||||
paths-to-match: '/**'
|
||||
packages-to-scan: org.liuxp.minioplus.extension.controller
|
||||
# knife4j的增强配置,不需要增强可以不配
|
||||
knife4j:
|
||||
enable: true
|
||||
setting:
|
||||
language: zh_cn
|
||||
##################################################################
|
||||
# 日志配置
|
||||
##################################################################
|
||||
logging:
|
||||
config: classpath:log/log-dev.xml
|
||||
##################################################################
|
||||
# 服务器
|
||||
##################################################################
|
||||
server:
|
||||
port: 9010
|
||||
##################################################################
|
||||
### MinIO Plus Config
|
||||
##################################################################
|
||||
minioplus:
|
||||
# MinIO 部署地址
|
||||
backend: http://localhost:9000
|
||||
# 浏览器访问地址,文件、图片上传下载访问地址代理,如果minio被nginx代理,需要配置这个参数为代理后的前端访问地址
|
||||
browser-url: http://localhost:9000
|
||||
# 授权key
|
||||
key: minioadmin
|
||||
# 密钥
|
||||
secret: minioadmin
|
||||
# 上传预签名URL有效期,单位为分钟,可选参数,默认值为60分钟
|
||||
upload-expiry: 120
|
||||
# 下载和预览预签名URL有效期,单位为分钟,可选参数,默认值为60分钟
|
||||
download-expiry: 20
|
||||
# 可选参数,分块配置
|
||||
part:
|
||||
# 可选参数,是否开启分块能力。默认为true
|
||||
enable: true
|
||||
# 可选参数,分块大小,配置单位为byte,默认为5242880
|
||||
size: 5242880
|
||||
# 可选参数,分块上传时建议并发数,默认为3
|
||||
iis: 2
|
||||
# 可选参数,缩略图配置
|
||||
thumbnail:
|
||||
# 可选参数,是否开启缩略图。默认为true
|
||||
enable: true
|
||||
# 可选参数,缩略图尺寸,默认为300
|
||||
size: 300
|
||||
@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 定义项目名称 用于后续的文件日志命名 test只是举例 按照实际的填 -->
|
||||
<property name="projectName" value="minio-plus-application-mysql"/>
|
||||
<!--%m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,%i索引【从数字0开始递增】,,,-->
|
||||
<!--appender是configuration的子节点,是负责写日志的组件。-->
|
||||
<!--ConsoleAppender:把日志输出到控制台-->
|
||||
<appender name="consoleLog" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>123%d{yyyy-MM-dd HH:mm:ss.SSS}[ %thread ]-[%-5level][%logger{50}:%line]-%msg%n</pattern>
|
||||
<!--控制台也要使用UTF-8,不要使用GBK,否则会中文乱码-->
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- debug 级别 -->
|
||||
<!--根据日志级别分离日志,分别输出到不同的文件-->
|
||||
<appender name="fileLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>DEBUG</level>
|
||||
</filter>
|
||||
<!--rollingPolicy:当发生滚动时,决定RollingFileAppender的行为,涉及文件移动和重命名。-->
|
||||
<!--TimeBasedRollingPolicy:最常用的滚动策略,它根据时间来制定滚动策略,既负责滚动也负责出发滚动-->
|
||||
<File>C:\logs\${projectName}\log\logback.log</File>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!--活动文件的名字会根据fileNamePattern的值,每隔一段时间改变一次-->
|
||||
<fileNamePattern>C:\logs\${projectName}\log\logback.%d.%i.log</fileNamePattern>
|
||||
<!--每产生一个日志文件,该日志文件的保存期限为30天-->
|
||||
<maxHistory>30</maxHistory>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<!--maxFileSize:这是活动文件的大小,默认值是10MB-->
|
||||
<maxFileSize>30MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}[ %thread ]-[%-5level][%logger{50}:%line]-%msg%n</pattern>
|
||||
<!--记录日志的编码-->
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
<appender name="fileErrorLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
<File>C:\logs\${projectName}\errorlog\errorlog.log</File>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>C:\logs\${projectName}\errorlog\errorlog.%d.%i.log</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>30MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}[ %thread ]-[%-5level][%logger{50}:%line]-%msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!--定义根节点-->
|
||||
<root level="info">
|
||||
<appender-ref ref="consoleLog"/>
|
||||
<appender-ref ref="fileLog"/>
|
||||
<appender-ref ref="fileErrorLog"/>
|
||||
</root>
|
||||
</configuration>
|
||||
@ -15,6 +15,7 @@
|
||||
<modules>
|
||||
<module>minio-plus-application-mysql</module>
|
||||
<module>minio-plus-application-schedule</module>
|
||||
<module>minio-plus-application-springboot3</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
@ -19,10 +19,6 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>minio-plus-common</artifactId>
|
||||
|
||||
@ -24,7 +24,6 @@ import org.liuxp.minioplus.core.engine.StorageEngineService;
|
||||
import org.liuxp.minioplus.core.repository.MetadataRepository;
|
||||
import org.liuxp.minioplus.s3.def.ListParts;
|
||||
import org.liuxp.minioplus.s3.def.MinioS3Client;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -127,7 +126,7 @@ public class StorageEngineServiceImpl implements StorageEngineService {
|
||||
if (!isSelf) {
|
||||
// 3.其他用户上传过,未完成,断点续传,新增文件元数据
|
||||
// 插入自己的元数据
|
||||
BeanUtils.copyProperties(uploadingMetadata, saveDTO);
|
||||
BeanUtil.copyProperties(uploadingMetadata, saveDTO);
|
||||
saveDTO.setFileName(fullFileName);
|
||||
saveDTO.setCreateUser(userId);
|
||||
saveDTO.setIsPrivate(isPrivate);
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package org.liuxp.minioplus.extension.context;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@ -11,25 +10,25 @@ import lombok.ToString;
|
||||
* @since 2024/05/22
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "Response")
|
||||
@Schema(description = "Response")
|
||||
@ToString
|
||||
public class Response<T> {
|
||||
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
@ApiModelProperty(value = "状态码")
|
||||
@Schema(description = "状态码")
|
||||
protected int code;
|
||||
|
||||
/**
|
||||
* 提示信息
|
||||
*/
|
||||
@ApiModelProperty(value = "操作成功")
|
||||
@Schema(description = "操作成功")
|
||||
protected String message;
|
||||
/**
|
||||
* 返回给页面的数据内容,不同接口格式不同
|
||||
*/
|
||||
@ApiModelProperty(value = "响应业务参数", dataType = "T")
|
||||
@Schema(description = "响应业务参数")
|
||||
protected T data;
|
||||
|
||||
public Response() {
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package org.liuxp.minioplus.extension.controller;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.liuxp.minioplus.api.StorageService;
|
||||
import org.liuxp.minioplus.api.model.vo.CompleteResultVo;
|
||||
@ -34,7 +34,7 @@ import java.io.ByteArrayInputStream;
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/storage")
|
||||
@Api(tags = "MinIO Plus Demo 接口")
|
||||
@Tag(name = "MinIO Plus 接口")
|
||||
@Slf4j
|
||||
public class StorageController {
|
||||
|
||||
@ -60,7 +60,7 @@ public class StorageController {
|
||||
* @param preShardingDTO 文件预分片入参DTO
|
||||
* @return 预分片结果
|
||||
*/
|
||||
@ApiOperation(value = "文件预分片")
|
||||
@Operation(summary = "文件预分片")
|
||||
@PostMapping("/upload/sharding")
|
||||
@ResponseBody
|
||||
public Response<FilePreShardingVo> sharding(@RequestBody @Validated PreShardingDTO preShardingDTO){
|
||||
@ -76,7 +76,7 @@ public class StorageController {
|
||||
* @param fileCheckDTO 文件预检查入参
|
||||
* @return 检查结果
|
||||
*/
|
||||
@ApiOperation(value = "上传任务初始化")
|
||||
@Operation(summary = "上传任务初始化")
|
||||
@PostMapping("/upload/init")
|
||||
@ResponseBody
|
||||
public Response<FileCheckResultVo> init(@RequestBody @Validated FileCheckDTO fileCheckDTO) {
|
||||
@ -95,7 +95,7 @@ public class StorageController {
|
||||
* @param fileCompleteDTO 文件完成入参DTO
|
||||
* @return 是否成功
|
||||
*/
|
||||
@ApiOperation(value = "上传完成")
|
||||
@Operation(summary = "上传完成")
|
||||
@PostMapping("/upload/complete/{fileKey}")
|
||||
@ResponseBody
|
||||
public Response<Object> complete(@PathVariable("fileKey") String fileKey, @RequestBody FileCompleteDTO fileCompleteDTO) {
|
||||
@ -115,7 +115,7 @@ public class StorageController {
|
||||
* @param fileKey 文件KEY
|
||||
* @return 文件下载地址
|
||||
*/
|
||||
@ApiOperation(value = "文件下载")
|
||||
@Operation(summary = "文件下载")
|
||||
@GetMapping("/download/{fileKey}")
|
||||
public String download(@PathVariable String fileKey) {
|
||||
|
||||
@ -131,7 +131,7 @@ public class StorageController {
|
||||
* @param fileKey 文件KEY
|
||||
* @return 原图地址
|
||||
*/
|
||||
@ApiOperation(value = "图片预览 - 原图")
|
||||
@Operation(summary = "图片预览 - 原图")
|
||||
@GetMapping("/image/{fileKey}")
|
||||
public String previewOriginal(@PathVariable String fileKey) {
|
||||
|
||||
@ -149,7 +149,7 @@ public class StorageController {
|
||||
* @param fileKey 文件KEY
|
||||
* @return 缩略图地址
|
||||
*/
|
||||
@ApiOperation(value = "图片预览 - 缩略图")
|
||||
@Operation(summary = "图片预览 - 缩略图")
|
||||
@GetMapping("/preview/{fileKey}")
|
||||
public String previewMedium(@PathVariable String fileKey) {
|
||||
|
||||
@ -171,7 +171,7 @@ public class StorageController {
|
||||
* @param response HttpServletResponse
|
||||
* @param fileType 文件扩展名
|
||||
*/
|
||||
@ApiOperation(value = "获取图标")
|
||||
@Operation(summary = "获取图标")
|
||||
@GetMapping("/icon/{fileType}")
|
||||
public void icon(HttpServletResponse response,@PathVariable String fileType) {
|
||||
try {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package org.liuxp.minioplus.extension.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
@ -15,19 +14,19 @@ import lombok.ToString;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@ApiModel("文件预检查入参DTO")
|
||||
@Schema(description = "文件预检查入参DTO")
|
||||
public class FileCheckDTO {
|
||||
|
||||
@ApiModelProperty(value = "文件md5", required = true)
|
||||
@Schema(description = "文件md5", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String fileMd5;
|
||||
|
||||
@ApiModelProperty(value = "文件名(含扩展名)", required = true)
|
||||
@Schema(description = "文件名(含扩展名)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String fullFileName;
|
||||
|
||||
@ApiModelProperty(value = "文件长度", required = true)
|
||||
@Schema(description = "文件长度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long fileSize;
|
||||
|
||||
@ApiModelProperty("是否私有 false:否 true:是")
|
||||
@Schema(description = "是否私有 false:否 true:是")
|
||||
private Boolean isPrivate;
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package org.liuxp.minioplus.extension.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
@ -17,10 +16,10 @@ import java.util.List;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@ApiModel("文件完成入参DTO")
|
||||
@Schema(description = "文件完成入参DTO")
|
||||
public class FileCompleteDTO {
|
||||
|
||||
@ApiModelProperty(value = "文件md5", required = true)
|
||||
@Schema(description = "文件md5", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<String> partMd5List;
|
||||
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
package org.liuxp.minioplus.extension.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
@ -15,10 +14,10 @@ import lombok.ToString;
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@ApiModel("文件预分片入参DTO")
|
||||
@Schema(description = "文件预分片入参DTO")
|
||||
public class PreShardingDTO {
|
||||
|
||||
@ApiModelProperty(value = "文件长度", required = true)
|
||||
@Schema(description = "文件长度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long fileSize;
|
||||
|
||||
}
|
||||
@ -17,17 +17,6 @@
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.11.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
|
||||
@ -20,12 +20,12 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>minio-plus-extension</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>s3-api-minio</artifactId>
|
||||
<artifactId>minio-plus-extension</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>minio-plus-spring-boot-starter</artifactId>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>minio-plus-all-springboot3-starter</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>minio-plus-extension</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger.jakarta.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,14 @@
|
||||
package org.liuxp.minioplus.common.config;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
/**
|
||||
* MinioPlusAutoConfiguration
|
||||
*
|
||||
* @author contact@liuxp.me
|
||||
* @since 2024/06/11
|
||||
*/
|
||||
@ComponentScan("org.liuxp.minioplus")
|
||||
public class MinioPlusAutoConfiguration {
|
||||
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
org.liuxp.minioplus.common.config.MinioPlusAutoConfiguration
|
||||
@ -20,12 +20,12 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>minio-plus-core</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>s3-api-minio</artifactId>
|
||||
<artifactId>minio-plus-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>minio-plus-spring-boot-starter</artifactId>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>minio-plus-core-springboot3-starter</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>minio-plus-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,14 @@
|
||||
package org.liuxp.minioplus.common.config;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
/**
|
||||
* MinioPlusAutoConfiguration
|
||||
*
|
||||
* @author contact@liuxp.me
|
||||
* @since 2024/06/11
|
||||
*/
|
||||
@ComponentScan("org.liuxp.minioplus")
|
||||
public class MinioPlusAutoConfiguration {
|
||||
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
org.liuxp.minioplus.common.config.MinioPlusAutoConfiguration
|
||||
@ -15,6 +15,8 @@
|
||||
<modules>
|
||||
<module>minio-plus-all-spring-boot-starter</module>
|
||||
<module>minio-plus-core-spring-boot-starter</module>
|
||||
<module>minio-plus-all-springboot3-starter</module>
|
||||
<module>minio-plus-core-springboot3-starter</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
22
pom.xml
22
pom.xml
@ -54,8 +54,9 @@
|
||||
<mybatisplus.version>3.5.7</mybatisplus.version>
|
||||
<lombok.version>1.18.32</lombok.version>
|
||||
<hutool.version>5.8.28</hutool.version>
|
||||
<knife4j.version>2.0.9</knife4j.version>
|
||||
<swagger.version>1.5.22</swagger.version>
|
||||
<knife4j.version>4.4.0</knife4j.version>
|
||||
<swagger.version>2.2.8</swagger.version>
|
||||
<swagger.jakarta.version>2.2.15</swagger.jakarta.version>
|
||||
<minio.version>8.5.11</minio.version>
|
||||
<thumbnailator.version>0.4.20</thumbnailator.version>
|
||||
</properties>
|
||||
@ -85,20 +86,20 @@
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.github.xiaoymin/knife4j-spring-boot-starter -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-annotations</artifactId>
|
||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/io.swagger/swagger-annotations -->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
</dependency>
|
||||
@ -154,12 +155,17 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>s3-api-definition</artifactId>
|
||||
<artifactId>minio-plus-all-springboot3-starter</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>minio-s3-api-custom</artifactId>
|
||||
<artifactId>minio-plus-core-springboot3-starter</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.liuxp</groupId>
|
||||
<artifactId>s3-api-definition</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user