添加上传人
This commit is contained in:
parent
3b2aac8602
commit
e2e93d2a5e
|
|
@ -66,10 +66,14 @@ public class UploadFileVo {
|
|||
*/
|
||||
private String createTime;
|
||||
|
||||
private String createUser;
|
||||
|
||||
/**
|
||||
* 获取bast64文件
|
||||
*/
|
||||
private String bast64;
|
||||
|
||||
private String userName;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.file.service.impl;
|
|||
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.file.config.MinioConfig;
|
||||
import com.bonus.file.mapper.FileUtilMapper;
|
||||
import com.bonus.file.utils.MinioUtil;
|
||||
|
|
@ -84,6 +85,7 @@ public class FileUtilsServiceImpl {
|
|||
String path="/"+bucketName+"/"+filePath;
|
||||
vo.setPath(path);
|
||||
vo.setUrl(minioConfig.getUrl());
|
||||
vo.setCreateUser(SecurityUtils.getUserId().toString());
|
||||
int num=mapper.insertUploadFile(vo);
|
||||
if(num>0){
|
||||
return vo;
|
||||
|
|
@ -136,6 +138,7 @@ public class FileUtilsServiceImpl {
|
|||
String path="/"+bucketName+"/"+filePath;
|
||||
vo.setPath(path);
|
||||
vo.setUrl(minioConfig.getUrl());
|
||||
vo.setCreateUser(SecurityUtils.getUserId().toString());
|
||||
int num=mapper.insertUploadFile(vo);
|
||||
if(num>0){
|
||||
return vo;
|
||||
|
|
@ -186,6 +189,7 @@ public class FileUtilsServiceImpl {
|
|||
String path="/"+bucketName+"/"+filePath;
|
||||
vo.setPath(path);
|
||||
vo.setUrl(minioConfig.getUrl());
|
||||
vo.setCreateUser(SecurityUtils.getUserId().toString());
|
||||
list.add(vo);
|
||||
}
|
||||
int num=mapper.insertUploadFileList(list);
|
||||
|
|
@ -242,6 +246,7 @@ public class FileUtilsServiceImpl {
|
|||
String path="/"+bucketName+"/"+filePath;
|
||||
vo.setPath(path);
|
||||
vo.setUrl(minioConfig.getUrl());
|
||||
vo.setCreateUser(SecurityUtils.getUserId().toString());
|
||||
list.add(vo);
|
||||
}
|
||||
int num=mapper.insertUploadFileList(list);
|
||||
|
|
|
|||
|
|
@ -7,16 +7,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<!--文件插入-->
|
||||
<insert id="insertUploadFile" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into bm_files(
|
||||
source_table, source_id, source_type, file_name, file_key,bucket_name, create_time, update_time, is_active, origin_file_name,file_url,file_path
|
||||
)values (#{sourceTable},#{sourceId},#{sourceType},#{fileName},#{filePath},#{bucketName},now(),now(),1,#{originFileName},#{url},#{path})
|
||||
source_table, source_id, source_type, file_name, file_key,bucket_name, create_time, update_time, is_active, origin_file_name,file_url,file_path,create_user
|
||||
)values (#{sourceTable},#{sourceId},#{sourceType},#{fileName},#{filePath},#{bucketName},now(),now(),1,#{originFileName},#{url},#{path},#{createUser})
|
||||
</insert>
|
||||
<!--多文件上传-->
|
||||
<insert id="insertUploadFileList" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into bm_files ( source_table, source_id, source_type, file_name, file_key,bucket_name, create_time, update_time, is_active, origin_file_name,file_url,file_path
|
||||
insert into bm_files ( source_table, source_id, source_type, file_name, file_key,bucket_name, create_time,
|
||||
update_time, is_active, origin_file_name,file_url,file_path,create_user
|
||||
) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.sourceTable},#{item.sourceId},#{item.sourceType},#{item.fileName},#{item.filePath},
|
||||
#{item.bucketName},now(),now(),1,#{item.originFileName},#{item.url},#{item.path})
|
||||
#{item.bucketName},now(),now(),1,#{item.originFileName},#{item.url},#{item.path},#{item.createUser})
|
||||
</foreach>
|
||||
</insert>
|
||||
<!--删除文件-->
|
||||
|
|
@ -48,30 +49,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
</update>
|
||||
<select id="getFileList" resultType="com.bonus.system.api.model.UploadFileVo">
|
||||
select id, source_table sourceTable, source_id sourceId, source_type sourceType, file_name fileName,
|
||||
file_key filePath, bucket_name bucketName, create_time createTime,
|
||||
origin_file_name originFileName, file_path path, file_url url
|
||||
from bm_files
|
||||
where is_active=1
|
||||
select file.id, file.source_table sourceTable, file.source_id sourceId, file.source_type sourceType, file.file_name fileName,
|
||||
file.file_key filePath, file.bucket_name bucketName, file.create_time createTime,
|
||||
file.origin_file_name originFileName, file.file_path path, file.file_url url,su.user_name userName
|
||||
from bm_files file
|
||||
left join sys_user su on su.user_id=file.create_user
|
||||
where file.is_active=1
|
||||
<if test="id!=null and id!=''">
|
||||
and id=#{id}
|
||||
and file.id=#{id}
|
||||
</if>
|
||||
<if test="sourceId !=null and sourceId!=''">
|
||||
and source_id=#{sourceId}
|
||||
and file.source_id=#{sourceId}
|
||||
</if>
|
||||
<if test="sourceType !=null and sourceType!=''">
|
||||
and source_type=#{sourceType}
|
||||
and file.source_type=#{sourceType}
|
||||
</if>
|
||||
<if test="sourceTable !=null and sourceTable!=''">
|
||||
and source_table=#{sourceTable}
|
||||
and file.source_table=#{sourceTable}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getFileListByIds" resultType="com.bonus.system.api.model.UploadFileVo">
|
||||
select id, source_table sourceTable, source_id sourceId, source_type sourceType, file_name fileName,
|
||||
file_key filePath, bucket_name bucketName, create_time createTime,
|
||||
origin_file_name originFileName, file_path path, file_url url
|
||||
from bm_files
|
||||
where id in
|
||||
select file.id, file.source_table sourceTable, file.source_id sourceId, file.source_type sourceType, file.file_name fileName,
|
||||
file.file_key filePath, file.bucket_name bucketName, file.create_time createTime,
|
||||
file.origin_file_name originFileName, file.file_path path, file.file_url url,su.user_name userName
|
||||
from bm_files file
|
||||
left join sys_user su on su.user_id=file.create_user
|
||||
where file.id in
|
||||
<foreach collection="ids" item="item" open="(" close=")" separator="," >
|
||||
#{item}
|
||||
</foreach>
|
||||
|
|
|
|||
Loading…
Reference in New Issue