系统集成 主体库模块
This commit is contained in:
parent
018d7693d1
commit
a4aab7d02e
|
|
@ -0,0 +1,88 @@
|
|||
package com.bonus.common.domain.file.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 系统资源文件表
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ResourceFilePo {
|
||||
|
||||
/**
|
||||
* 资源文件id
|
||||
*/
|
||||
private Long sourceId;
|
||||
|
||||
/**
|
||||
* 来源表
|
||||
*/
|
||||
private String sourceTable;
|
||||
|
||||
/**
|
||||
* 文件id/路径
|
||||
*/
|
||||
private String filePath;
|
||||
|
||||
/**
|
||||
* 源文件名称
|
||||
*/
|
||||
private String sourceFileName;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件后缀名称
|
||||
*/
|
||||
private String suffixName;
|
||||
|
||||
/**
|
||||
* 文件类型
|
||||
*/
|
||||
private String fileType;
|
||||
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 业务类型(字典表配置)
|
||||
*/
|
||||
private String businessType;
|
||||
|
||||
/**
|
||||
* 文件大小
|
||||
*/
|
||||
private BigDecimal fileSize;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 删除状态 0.未删除 1.删除
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.file.mapper;
|
||||
|
||||
import com.bonus.common.domain.file.po.ResourceFilePo;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:ISourceFileMapper
|
||||
* @author:cwchen
|
||||
* @date:2025-10-17-13:48
|
||||
* @version:1.0
|
||||
* @description:系统资源库数据库层
|
||||
*/
|
||||
@Repository(value = "ISourceFileMapper")
|
||||
public interface ISourceFileMapper {
|
||||
|
||||
/**
|
||||
* 保存系统资源文件数据
|
||||
* @param list
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2025/10/17 14:16
|
||||
*/
|
||||
void saveResourceFile(List<ResourceFilePo> list);
|
||||
}
|
||||
|
|
@ -8,7 +8,6 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @className:FileUploadService
|
||||
|
|
@ -75,20 +74,10 @@ public class FileUploadService {
|
|||
try{
|
||||
String fileUrl = minioUtil.getFileUrl(minioConfig.getBucketName(), filePath, 60 * 60 * 12);
|
||||
String lsUrl= fileUrl.replace(minioConfig.getEndpoint(),minioConfig.getUrl());
|
||||
String url = minioConfig.getUrl() + File.separator + filePath;
|
||||
log.info("临时路径:{}",lsUrl);
|
||||
return SysFile.builder()
|
||||
.name("文件名称")
|
||||
.url(url).build();
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public SysFile getFile2(String filePath) {
|
||||
try{
|
||||
minioUtil.getFileUrl(null,null);
|
||||
.url(lsUrl).build();
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.bonus.file.service;
|
||||
|
||||
import com.bonus.common.domain.file.po.ResourceFilePo;
|
||||
import com.bonus.file.mapper.ISourceFileMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:SourceFileService
|
||||
* @author:cwchen
|
||||
* @date:2025-10-17-13:46
|
||||
* @version:1.0
|
||||
* @description:系统资源库实现类
|
||||
*/
|
||||
@Service(value = "SourceFileService")
|
||||
public class SourceFileService {
|
||||
|
||||
@Resource(name = "ISourceFileMapper")
|
||||
private ISourceFileMapper mapper;
|
||||
|
||||
/**
|
||||
* 保存系统文件
|
||||
* @param list
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2025/10/17 14:45
|
||||
*/
|
||||
public void saveResourceFile(List<ResourceFilePo> list) {
|
||||
mapper.saveResourceFile(list);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.file.mapper.ISourceFileMapper">
|
||||
|
||||
<!--保存系统资源文件数据-->
|
||||
<insert id="saveResourceFile">
|
||||
INSERT INTO sys_resource_file
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="list[0].sourceTable != null and list[0].sourceTable != ''">source_table,</if>
|
||||
<if test="list[0].filePath != null and list[0].filePath != ''">file_path,</if>
|
||||
<if test="list[0].sourceFileName != null and list[0].sourceFileName != ''">source_file_name,</if>
|
||||
<if test="list[0].fileName != null and list[0].fileName != ''">file_name,</if>
|
||||
<if test="list[0].suffixName != null and list[0].suffixName != ''">suffix_name,</if>
|
||||
<if test="list[0].fileType != null and list[0].fileType != ''">file_type,</if>
|
||||
<if test="list[0].businessId != null">business_id,</if>
|
||||
<if test="list[0].businessType != null and list[0].businessType != ''">business_type,</if>
|
||||
<if test="list[0].fileSize != null">file_size,</if>
|
||||
<if test="list[0].createUserId != null">create_user_id,</if>
|
||||
<if test="list[0].createUserName != null and list[0].createUserName != ''">create_user_name,</if>
|
||||
<if test="list[0].delFlag != null and list[0].delFlag != ''">del_flag,</if>
|
||||
</trim>
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="item.sourceTable != null and item.sourceTable != ''">#{item.sourceTable},</if>
|
||||
<if test="item.filePath != null and item.filePath != ''">#{item.filePath},</if>
|
||||
<if test="item.sourceFileName != null and item.sourceFileName != ''">#{item.sourceFileName},</if>
|
||||
<if test="item.fileName != null and item.fileName != ''">#{item.fileName},</if>
|
||||
<if test="item.suffixName != null and item.suffixName != ''">#{item.suffixName},</if>
|
||||
<if test="item.fileType != null and item.fileType != ''">#{item.fileType},</if>
|
||||
<if test="item.businessId != null">#{item.businessId},</if>
|
||||
<if test="item.businessType != null and item.businessType != ''">#{item.businessType},</if>
|
||||
<if test="item.fileSize != null">#{item.fileSize},</if>
|
||||
<if test="item.createUserId != null">#{item.createUserId},</if>
|
||||
<if test="item.createUserName != null and item.createUserName != ''">#{item.createUserName},</if>
|
||||
<if test="item.delFlag != null and item.delFlag != ''">#{item.delFlag},</if>
|
||||
</trim>
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue