【MINIO上传的文件信息保存】
This commit is contained in:
parent
aadd300cb8
commit
1dd77a87b9
@ -1,12 +1,12 @@
|
|||||||
create TABLE `minio_file_info` (
|
create TABLE `minio_file_info` (
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT comment '主键',
|
`id` bigint NOT NULL AUTO_INCREMENT comment '主键',
|
||||||
`title` varchar(255) DEFAULT NULL comment '文件展示名称',
|
`title` varchar(255) DEFAULT NULL comment '文件展示名称',
|
||||||
`type` varchar(255) DEFAULT NULL comment '文件类型',
|
`directory` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL comment '文件夹',
|
||||||
`file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL comment '存放路径',
|
`file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL comment '存放文件名',
|
||||||
`create_time` datetime DEFAULT NULL comment '创建时间',
|
`create_time` datetime DEFAULT NULL comment '创建时间',
|
||||||
`creator` bigint DEFAULT NULL comment '创建者',
|
`creator` bigint DEFAULT NULL comment '创建者',
|
||||||
`status` int DEFAULT NULL comment '状态',
|
`status` int DEFAULT NULL comment '状态',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `type` (`type`),
|
KEY `type` (`directory`),
|
||||||
KEY `status` (`status`)
|
KEY `status` (`status`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
@ -1,11 +1,10 @@
|
|||||||
package club.joylink.rtss.controller;
|
package club.joylink.rtss.controller;
|
||||||
|
|
||||||
import club.joylink.rtss.entity.minio.MinioDirectory;
|
|
||||||
import club.joylink.rtss.entity.minio.MinioFileInfo;
|
import club.joylink.rtss.entity.minio.MinioFileInfo;
|
||||||
import club.joylink.rtss.services.MinioService;
|
import club.joylink.rtss.services.MinioService;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
|
import club.joylink.rtss.vo.minio.MinioFilePageVO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -18,26 +17,14 @@ public class MinioController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private MinioService minioService;
|
private MinioService minioService;
|
||||||
|
|
||||||
@PostMapping("/file/case/save")
|
@PostMapping("/file/save")
|
||||||
public void saveTestcaseFile(@RequestAttribute AccountVO user, @RequestBody MinioFileInfo fileInfo) {
|
public void saveFile(@RequestAttribute AccountVO user, @RequestBody MinioFileInfo fileInfo) {
|
||||||
fileInfo.setType(MinioDirectory.CASE.name());
|
|
||||||
minioService.saveFileInfo(user, fileInfo);
|
minioService.saveFileInfo(user, fileInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/file/case/list")
|
@GetMapping("/file/list")
|
||||||
public PageVO<MinioFileInfo> queryCaseFileInfo(PageQueryVO pageVO) {
|
public PageVO<MinioFileInfo> queryFileInfo(MinioFilePageVO pageVO) {
|
||||||
return minioService.queryFileInfoList(pageVO, MinioDirectory.CASE);
|
return minioService.queryFileInfoList(pageVO);
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/file/logo/save")
|
|
||||||
public void saveLogoFile(@RequestAttribute AccountVO user, @RequestBody MinioFileInfo fileInfo) {
|
|
||||||
fileInfo.setType(MinioDirectory.LOGO.name());
|
|
||||||
minioService.saveFileInfo(user, fileInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/file/logo/list")
|
|
||||||
public PageVO<MinioFileInfo> queryLogoFileInfo(PageQueryVO pageVO) {
|
|
||||||
return minioService.queryFileInfoList(pageVO, MinioDirectory.LOGO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/file/update")
|
@PutMapping("/file/update")
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
package club.joylink.rtss.entity.minio;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* minio文件夹配置
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
public enum MinioDirectory {
|
|
||||||
CASE("案例展示", "case"),
|
|
||||||
LOGO("网站logo图片", "logo");
|
|
||||||
|
|
||||||
MinioDirectory(String name, String directory) {
|
|
||||||
this.name = name;
|
|
||||||
this.directory = directory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 名称描述
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件存储MINIO文件夹
|
|
||||||
*/
|
|
||||||
private String directory;
|
|
||||||
}
|
|
@ -21,7 +21,7 @@ public class MinioFileInfo {
|
|||||||
/**
|
/**
|
||||||
* 文件所属类型
|
* 文件所属类型
|
||||||
*/
|
*/
|
||||||
private String type;
|
private String directory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件名称
|
* 文件名称
|
||||||
|
@ -235,76 +235,6 @@ public class MinioFileInfoExample {
|
|||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTypeIsNull() {
|
|
||||||
addCriterion("type is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeIsNotNull() {
|
|
||||||
addCriterion("type is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeEqualTo(String value) {
|
|
||||||
addCriterion("type =", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeNotEqualTo(String value) {
|
|
||||||
addCriterion("type <>", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeGreaterThan(String value) {
|
|
||||||
addCriterion("type >", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("type >=", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeLessThan(String value) {
|
|
||||||
addCriterion("type <", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("type <=", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeLike(String value) {
|
|
||||||
addCriterion("type like", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeNotLike(String value) {
|
|
||||||
addCriterion("type not like", value, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeIn(List<String> values) {
|
|
||||||
addCriterion("type in", values, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeNotIn(List<String> values) {
|
|
||||||
addCriterion("type not in", values, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeBetween(String value1, String value2) {
|
|
||||||
addCriterion("type between", value1, value2, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andTypeNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("type not between", value1, value2, "type");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDirectoryIsNull() {
|
public Criteria andDirectoryIsNull() {
|
||||||
addCriterion("directory is null");
|
addCriterion("directory is null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package club.joylink.rtss.services;
|
package club.joylink.rtss.services;
|
||||||
|
|
||||||
import club.joylink.rtss.entity.minio.MinioDirectory;
|
|
||||||
import club.joylink.rtss.entity.minio.MinioFileInfo;
|
import club.joylink.rtss.entity.minio.MinioFileInfo;
|
||||||
import club.joylink.rtss.util.MinioClientUtil;
|
import club.joylink.rtss.util.MinioClientUtil;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
|
import club.joylink.rtss.vo.minio.MinioFilePageVO;
|
||||||
|
|
||||||
public interface MinioService {
|
public interface MinioService {
|
||||||
/**
|
/**
|
||||||
@ -21,7 +20,7 @@ public interface MinioService {
|
|||||||
/**
|
/**
|
||||||
* 获取对应的文件列表
|
* 获取对应的文件列表
|
||||||
*/
|
*/
|
||||||
PageVO<MinioFileInfo> queryFileInfoList(PageQueryVO pageQueryVO, MinioDirectory directory);
|
PageVO<MinioFileInfo> queryFileInfoList(MinioFilePageVO pageQueryVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除文档
|
* 删除文档
|
||||||
|
@ -2,17 +2,17 @@ package club.joylink.rtss.services;
|
|||||||
|
|
||||||
import club.joylink.rtss.configuration.MinioClientConfig;
|
import club.joylink.rtss.configuration.MinioClientConfig;
|
||||||
import club.joylink.rtss.dao.minio.MinioFileInfoDao;
|
import club.joylink.rtss.dao.minio.MinioFileInfoDao;
|
||||||
import club.joylink.rtss.entity.minio.MinioDirectory;
|
|
||||||
import club.joylink.rtss.entity.minio.MinioFileInfo;
|
import club.joylink.rtss.entity.minio.MinioFileInfo;
|
||||||
import club.joylink.rtss.entity.minio.MinioFileInfoExample;
|
import club.joylink.rtss.entity.minio.MinioFileInfoExample;
|
||||||
import club.joylink.rtss.util.MinioClientUtil;
|
import club.joylink.rtss.util.MinioClientUtil;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
|
import club.joylink.rtss.vo.minio.MinioFilePageVO;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -47,11 +47,14 @@ public class MinioServiceImpl implements MinioService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageVO<MinioFileInfo> queryFileInfoList(PageQueryVO queryVO, MinioDirectory directory) {
|
public PageVO<MinioFileInfo> queryFileInfoList(MinioFilePageVO queryVO) {
|
||||||
MinioFileInfoExample example = new MinioFileInfoExample();
|
MinioFileInfoExample example = new MinioFileInfoExample();
|
||||||
MinioFileInfoExample.Criteria criteria = example.createCriteria().andStatusEqualTo(1);
|
MinioFileInfoExample.Criteria criteria = example.createCriteria().andStatusEqualTo(1);
|
||||||
if (directory != null) {
|
if (!StringUtils.isEmpty(queryVO.getDirectory())) {
|
||||||
criteria.andTypeEqualTo(directory.name());
|
criteria.andDirectoryEqualTo(queryVO.getDirectory());
|
||||||
|
}
|
||||||
|
if (!StringUtils.isEmpty(queryVO.getTitle())) {
|
||||||
|
criteria.andTitleLike(queryVO.getTitle());
|
||||||
}
|
}
|
||||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||||
Page<MinioFileInfo> minioFileInfoPage = (Page<MinioFileInfo>) this.minioFileInfoDao.selectByExample(example);
|
Page<MinioFileInfo> minioFileInfoPage = (Page<MinioFileInfo>) this.minioFileInfoDao.selectByExample(example);
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package club.joylink.rtss.vo.minio;
|
||||||
|
|
||||||
|
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MinioFilePageVO extends PageQueryVO {
|
||||||
|
/**
|
||||||
|
* 文件文件夹
|
||||||
|
*/
|
||||||
|
private String directory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目title
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
}
|
@ -4,7 +4,7 @@
|
|||||||
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.minio.MinioFileInfo">
|
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.minio.MinioFileInfo">
|
||||||
<id column="id" property="id" jdbcType="BIGINT"/>
|
<id column="id" property="id" jdbcType="BIGINT"/>
|
||||||
<result column="title" property="title" jdbcType="VARCHAR"/>
|
<result column="title" property="title" jdbcType="VARCHAR"/>
|
||||||
<result column="type" property="type" jdbcType="VARCHAR"/>
|
<result column="directory" property="directory" jdbcType="VARCHAR"/>
|
||||||
<result column="file_name" property="fileName" jdbcType="VARCHAR"/>
|
<result column="file_name" property="fileName" jdbcType="VARCHAR"/>
|
||||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||||
<result column="creator" property="creator" jdbcType="BIGINT"/>
|
<result column="creator" property="creator" jdbcType="BIGINT"/>
|
||||||
@ -71,7 +71,7 @@
|
|||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, title, type, file_name, create_time, creator, status
|
id, title, `directory`, file_name, create_time, creator, status
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByExample" resultMap="BaseResultMap"
|
<select id="selectByExample" resultMap="BaseResultMap"
|
||||||
parameterType="club.joylink.rtss.entity.minio.MinioFileInfoExample">
|
parameterType="club.joylink.rtss.entity.minio.MinioFileInfoExample">
|
||||||
@ -101,8 +101,8 @@
|
|||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="club.joylink.rtss.entity.minio.MinioFileInfo" keyColumn="id"
|
<insert id="insert" parameterType="club.joylink.rtss.entity.minio.MinioFileInfo" keyColumn="id"
|
||||||
useGeneratedKeys="true" keyProperty="id">
|
useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into minio_file_info (title, type, file_name, create_time, creator, status)
|
insert into minio_file_info (title, directory, file_name, create_time, creator, status)
|
||||||
values (#{title,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR},
|
values (#{title,jdbcType=VARCHAR}, #{directory,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR},
|
||||||
#{createTime,jdbcType=TIMESTAMP}, #{creator,jdbcType=BIGINT}, #{status,jdbcType=INTEGER})
|
#{createTime,jdbcType=TIMESTAMP}, #{creator,jdbcType=BIGINT}, #{status,jdbcType=INTEGER})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.minio.MinioFileInfo">
|
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.minio.MinioFileInfo">
|
||||||
@ -114,8 +114,8 @@
|
|||||||
<if test="title != null">
|
<if test="title != null">
|
||||||
title,
|
title,
|
||||||
</if>
|
</if>
|
||||||
<if test="type != null">
|
<if test="directory != null">
|
||||||
type,
|
`directory`,
|
||||||
</if>
|
</if>
|
||||||
<if test="fileName != null">
|
<if test="fileName != null">
|
||||||
file_name,
|
file_name,
|
||||||
@ -137,8 +137,8 @@
|
|||||||
<if test="title != null">
|
<if test="title != null">
|
||||||
#{title,jdbcType=VARCHAR},
|
#{title,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="type != null">
|
<if test="directory != null">
|
||||||
#{type,jdbcType=VARCHAR},
|
#{directory,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="fileName != null">
|
<if test="fileName != null">
|
||||||
#{fileName,jdbcType=VARCHAR},
|
#{fileName,jdbcType=VARCHAR},
|
||||||
@ -163,8 +163,8 @@
|
|||||||
<if test="record.title != null">
|
<if test="record.title != null">
|
||||||
title = #{record.title,jdbcType=VARCHAR},
|
title = #{record.title,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.type != null">
|
<if test="record.directory != null">
|
||||||
type = #{record.type,jdbcType=VARCHAR},
|
type = #{record.directory,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.fileName != null">
|
<if test="record.fileName != null">
|
||||||
file_name = #{record.fileName,jdbcType=VARCHAR},
|
file_name = #{record.fileName,jdbcType=VARCHAR},
|
||||||
@ -187,7 +187,7 @@
|
|||||||
update minio_file_info
|
update minio_file_info
|
||||||
set id = #{record.id,jdbcType=BIGINT},
|
set id = #{record.id,jdbcType=BIGINT},
|
||||||
title = #{record.title,jdbcType=VARCHAR},
|
title = #{record.title,jdbcType=VARCHAR},
|
||||||
type = #{record.type,jdbcType=VARCHAR},
|
`directory` = #{record.directory,jdbcType=VARCHAR},
|
||||||
file_name = #{record.fileName,jdbcType=VARCHAR},
|
file_name = #{record.fileName,jdbcType=VARCHAR},
|
||||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||||
creator = #{record.creator,jdbcType=BIGINT},
|
creator = #{record.creator,jdbcType=BIGINT},
|
||||||
@ -202,8 +202,8 @@
|
|||||||
<if test="title != null">
|
<if test="title != null">
|
||||||
title = #{title,jdbcType=VARCHAR},
|
title = #{title,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="type != null">
|
<if test="directory != null">
|
||||||
type = #{type,jdbcType=VARCHAR},
|
`directory` = #{directory,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="fileName != null">
|
<if test="fileName != null">
|
||||||
file_name = #{fileName,jdbcType=VARCHAR},
|
file_name = #{fileName,jdbcType=VARCHAR},
|
||||||
@ -223,7 +223,7 @@
|
|||||||
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.minio.MinioFileInfo">
|
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.minio.MinioFileInfo">
|
||||||
update minio_file_info
|
update minio_file_info
|
||||||
set title = #{title,jdbcType=VARCHAR},
|
set title = #{title,jdbcType=VARCHAR},
|
||||||
type = #{type,jdbcType=VARCHAR},
|
`directory` = #{directory,jdbcType=VARCHAR},
|
||||||
file_name = #{fileName,jdbcType=VARCHAR},
|
file_name = #{fileName,jdbcType=VARCHAR},
|
||||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
creator = #{creator,jdbcType=BIGINT},
|
creator = #{creator,jdbcType=BIGINT},
|
||||||
|
Loading…
Reference in New Issue
Block a user