mirror of
https://gitee.com/y_project/RuoYi-Cloud.git
synced 2026-01-26 11:51:55 +08:00
文件存储时记录数据库
This commit is contained in:
@@ -2,11 +2,10 @@ package com.ruoyi.common.core.utils.file;
|
||||
|
||||
/**
|
||||
* 媒体类型工具类
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class MimeTypeUtils
|
||||
{
|
||||
public class MimeTypeUtils {
|
||||
public static final String IMAGE_PNG = "image/png";
|
||||
|
||||
public static final String IMAGE_JPG = "image/jpg";
|
||||
@@ -17,14 +16,14 @@ public class MimeTypeUtils
|
||||
|
||||
public static final String IMAGE_GIF = "image/gif";
|
||||
|
||||
public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" };
|
||||
public static final String[] IMAGE_EXTENSION = {"bmp", "gif", "jpg", "jpeg", "png"};
|
||||
|
||||
public static final String[] FLASH_EXTENSION = { "swf", "flv" };
|
||||
public static final String[] FLASH_EXTENSION = {"swf", "flv"};
|
||||
|
||||
public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg",
|
||||
"asf", "rm", "rmvb" };
|
||||
public static final String[] MEDIA_EXTENSION = {"swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg",
|
||||
"asf", "rm", "rmvb"};
|
||||
|
||||
public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" };
|
||||
public static final String[] VIDEO_EXTENSION = {"mp4", "avi", "rmvb"};
|
||||
|
||||
public static final String[] DEFAULT_ALLOWED_EXTENSION = {
|
||||
// 图片
|
||||
@@ -36,12 +35,11 @@ public class MimeTypeUtils
|
||||
// 视频格式
|
||||
"mp4", "avi", "rmvb",
|
||||
// pdf
|
||||
"pdf" };
|
||||
"pdf",
|
||||
};
|
||||
|
||||
public static String getExtension(String prefix)
|
||||
{
|
||||
switch (prefix)
|
||||
{
|
||||
public static String getExtension(String prefix) {
|
||||
switch (prefix) {
|
||||
case IMAGE_PNG:
|
||||
return "png";
|
||||
case IMAGE_JPG:
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Dynamic DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
|
||||
@@ -19,13 +19,7 @@
|
||||
<!-- RuoYi Common Security -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-log</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<artifactId>ruoyi-common-security</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.ruoyi.common.services.config;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.FilterType;
|
||||
|
||||
/**
|
||||
* 本模块全局配置
|
||||
@@ -9,10 +11,15 @@ import org.springframework.context.annotation.Configuration;
|
||||
* @author Alan Scipio
|
||||
* created on 2024/2/19
|
||||
*/
|
||||
@ComponentScan("com.ruoyi.common.services")
|
||||
@MapperScan("com.ruoyi.common.services.mapper")
|
||||
@ComponentScan(value = "com.ruoyi.common.services", excludeFilters = {
|
||||
@ComponentScan.Filter(type = FilterType.REGEX, pattern = "com.ruoyi.common.services.mapper.*"),
|
||||
})
|
||||
@Configuration
|
||||
public class ServicesConfig {
|
||||
|
||||
|
||||
public ServicesConfig() {
|
||||
System.out.println("Common Module ServicesConfig init");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.ruoyi.common.services.constants;
|
||||
|
||||
import com.ruoyi.common.core.constant.IEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author Alan Scipio
|
||||
* created on 2024/2/19
|
||||
*/
|
||||
@Getter
|
||||
public enum FileStorageType implements IEnum {
|
||||
|
||||
LOCAL(1, "本地文件存储"),
|
||||
|
||||
FAST_DFS(2, "FastDFS文件存储"),
|
||||
|
||||
MINIO(3, "MinIO文件存储"),
|
||||
|
||||
;
|
||||
|
||||
private final int code;
|
||||
private final String name;
|
||||
|
||||
FileStorageType(int code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.ruoyi.common.services.domain;
|
||||
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This class was generated by MyBatis Generator.
|
||||
*
|
||||
* <ul>
|
||||
* <li> Table: sys_file </li>
|
||||
* <li> Remarks: 文件存储记录表 </li>
|
||||
* </ul>
|
||||
*
|
||||
* @author ryas
|
||||
* created on 2024-02-19
|
||||
*/
|
||||
public class SysFile extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
private String fileId;
|
||||
|
||||
/**
|
||||
* 保存的文件名称
|
||||
*/
|
||||
private String savedName;
|
||||
|
||||
/**
|
||||
* 原始文件名称
|
||||
*/
|
||||
private String originalName;
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
private String filePath;
|
||||
|
||||
/**
|
||||
* 文件后缀
|
||||
*/
|
||||
private String extension;
|
||||
|
||||
/**
|
||||
* 存储方式
|
||||
*/
|
||||
private String storageType;
|
||||
|
||||
/**
|
||||
* 获取文件的URL
|
||||
*/
|
||||
private String requestUrl;
|
||||
|
||||
/**
|
||||
* 文件大小(Byte)
|
||||
*/
|
||||
private Long fileSize;
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public String getFileId() {
|
||||
return fileId;
|
||||
}
|
||||
|
||||
public void setFileId(String fileId) {
|
||||
this.fileId = fileId == null ? null : fileId.trim();
|
||||
}
|
||||
|
||||
public String getSavedName() {
|
||||
return savedName;
|
||||
}
|
||||
|
||||
public void setSavedName(String savedName) {
|
||||
this.savedName = savedName == null ? null : savedName.trim();
|
||||
}
|
||||
|
||||
public String getOriginalName() {
|
||||
return originalName;
|
||||
}
|
||||
|
||||
public void setOriginalName(String originalName) {
|
||||
this.originalName = originalName == null ? null : originalName.trim();
|
||||
}
|
||||
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath == null ? null : filePath.trim();
|
||||
}
|
||||
|
||||
public String getExtension() {
|
||||
return extension;
|
||||
}
|
||||
|
||||
public void setExtension(String extension) {
|
||||
this.extension = extension == null ? null : extension.trim();
|
||||
}
|
||||
|
||||
public String getStorageType() {
|
||||
return storageType;
|
||||
}
|
||||
|
||||
public void setStorageType(String storageType) {
|
||||
this.storageType = storageType == null ? null : storageType.trim();
|
||||
}
|
||||
|
||||
public String getRequestUrl() {
|
||||
return requestUrl;
|
||||
}
|
||||
|
||||
public void setRequestUrl(String requestUrl) {
|
||||
this.requestUrl = requestUrl == null ? null : requestUrl.trim();
|
||||
}
|
||||
|
||||
public Long getFileSize() {
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
public void setFileSize(Long fileSize) {
|
||||
this.fileSize = fileSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", fileId=").append(fileId);
|
||||
sb.append(", savedName=").append(savedName);
|
||||
sb.append(", originalName=").append(originalName);
|
||||
sb.append(", filePath=").append(filePath);
|
||||
sb.append(", extension=").append(extension);
|
||||
sb.append(", storageType=").append(storageType);
|
||||
sb.append(", requestUrl=").append(requestUrl);
|
||||
sb.append(", fileSize=").append(fileSize);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.ruoyi.common.services.mapper;
|
||||
|
||||
import org.mybatis.dynamic.sql.AliasableSqlTable;
|
||||
import org.mybatis.dynamic.sql.SqlColumn;
|
||||
|
||||
import java.sql.JDBCType;
|
||||
import java.util.Date;
|
||||
|
||||
public final class SysFileDynamicSqlSupport {
|
||||
public static final SysFile sysFile = new SysFile();
|
||||
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
public static final SqlColumn<String> fileId = sysFile.fileId;
|
||||
|
||||
/**
|
||||
* 保存的文件名称
|
||||
*/
|
||||
public static final SqlColumn<String> savedName = sysFile.savedName;
|
||||
|
||||
/**
|
||||
* 原始文件名称
|
||||
*/
|
||||
public static final SqlColumn<String> originalName = sysFile.originalName;
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
public static final SqlColumn<String> filePath = sysFile.filePath;
|
||||
|
||||
/**
|
||||
* 文件后缀
|
||||
*/
|
||||
public static final SqlColumn<String> extension = sysFile.extension;
|
||||
|
||||
/**
|
||||
* 存储方式
|
||||
*/
|
||||
public static final SqlColumn<String> storageType = sysFile.storageType;
|
||||
|
||||
/**
|
||||
* 获取文件的URL
|
||||
*/
|
||||
public static final SqlColumn<String> requestUrl = sysFile.requestUrl;
|
||||
|
||||
/**
|
||||
* 文件大小(Byte)
|
||||
*/
|
||||
public static final SqlColumn<Long> fileSize = sysFile.fileSize;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
public static final SqlColumn<String> createBy = sysFile.createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
public static final SqlColumn<Date> createTime = sysFile.createTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
public static final SqlColumn<String> updateBy = sysFile.updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
public static final SqlColumn<Date> updateTime = sysFile.updateTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
public static final SqlColumn<String> remark = sysFile.remark;
|
||||
|
||||
public static final class SysFile extends AliasableSqlTable<SysFile> {
|
||||
public final SqlColumn<String> fileId = column("file_id", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> savedName = column("saved_name", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> originalName = column("original_name", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> filePath = column("file_path", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> extension = column("extension", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> storageType = column("storage_type", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> requestUrl = column("request_url", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<Long> fileSize = column("file_size", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<String> createBy = column("create_by", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public final SqlColumn<String> updateBy = column("update_by", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<Date> updateTime = column("update_time", JDBCType.TIMESTAMP);
|
||||
|
||||
public final SqlColumn<String> remark = column("remark", JDBCType.VARCHAR);
|
||||
|
||||
public SysFile() {
|
||||
super("sys_file", SysFile::new);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
package com.ruoyi.common.services.mapper;
|
||||
|
||||
import com.ruoyi.common.security.utils.SecurityUtilsExt;
|
||||
import com.ruoyi.common.services.domain.SysFile;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.mybatis.dynamic.sql.BasicColumn;
|
||||
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSL;
|
||||
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
|
||||
import org.mybatis.dynamic.sql.update.UpdateModel;
|
||||
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||
import org.mybatis.dynamic.sql.util.mybatis3.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.ruoyi.common.services.mapper.SysFileDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
|
||||
@Mapper
|
||||
public interface SysFileMapper extends CommonCountMapper, CommonDeleteMapper, CommonInsertMapper<SysFile>, CommonUpdateMapper {
|
||||
BasicColumn[] selectList = BasicColumn.columnList(fileId, savedName, originalName, filePath, extension, storageType, requestUrl, fileSize, createBy, createTime, updateBy, updateTime, remark);
|
||||
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@Results(id="SysFileResult", value = {
|
||||
@Result(column="file_id", property="fileId", jdbcType=JdbcType.VARCHAR, id=true),
|
||||
@Result(column="saved_name", property="savedName", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="original_name", property="originalName", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="file_path", property="filePath", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="extension", property="extension", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="storage_type", property="storageType", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="request_url", property="requestUrl", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="file_size", property="fileSize", jdbcType=JdbcType.BIGINT),
|
||||
@Result(column="create_by", property="createBy", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
|
||||
@Result(column="update_by", property="updateBy", jdbcType=JdbcType.VARCHAR),
|
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
|
||||
@Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR)
|
||||
})
|
||||
List<SysFile> selectMany(SelectStatementProvider selectStatement);
|
||||
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@ResultMap("SysFileResult")
|
||||
Optional<SysFile> selectOne(SelectStatementProvider selectStatement);
|
||||
|
||||
default long count(CountDSLCompleter completer) {
|
||||
return MyBatis3Utils.countFrom(this::count, sysFile, completer);
|
||||
}
|
||||
|
||||
default int delete(DeleteDSLCompleter completer) {
|
||||
return MyBatis3Utils.deleteFrom(this::delete, sysFile, completer);
|
||||
}
|
||||
|
||||
default int deleteByPrimaryKey(String fileId_) {
|
||||
return delete(c ->
|
||||
c.where(fileId, isEqualTo(fileId_))
|
||||
);
|
||||
}
|
||||
|
||||
default int insert(SysFile row) {
|
||||
row.setCommonForInsert(SecurityUtilsExt.getUserIdStr());
|
||||
return MyBatis3Utils.insert(this::insert, row, sysFile, c ->
|
||||
c.map(fileId).toProperty("fileId")
|
||||
.map(savedName).toProperty("savedName")
|
||||
.map(originalName).toProperty("originalName")
|
||||
.map(filePath).toProperty("filePath")
|
||||
.map(extension).toProperty("extension")
|
||||
.map(storageType).toProperty("storageType")
|
||||
.map(requestUrl).toProperty("requestUrl")
|
||||
.map(fileSize).toProperty("fileSize")
|
||||
.map(createBy).toProperty("createBy")
|
||||
.map(createTime).toProperty("createTime")
|
||||
.map(updateBy).toProperty("updateBy")
|
||||
.map(updateTime).toProperty("updateTime")
|
||||
.map(remark).toProperty("remark")
|
||||
);
|
||||
}
|
||||
|
||||
default int insertMultiple(Collection<SysFile> records) {
|
||||
for (SysFile row : records) {
|
||||
row.setCommonForInsert(SecurityUtilsExt.getUserIdStr());
|
||||
}
|
||||
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, sysFile, c ->
|
||||
c.map(fileId).toProperty("fileId")
|
||||
.map(savedName).toProperty("savedName")
|
||||
.map(originalName).toProperty("originalName")
|
||||
.map(filePath).toProperty("filePath")
|
||||
.map(extension).toProperty("extension")
|
||||
.map(storageType).toProperty("storageType")
|
||||
.map(requestUrl).toProperty("requestUrl")
|
||||
.map(fileSize).toProperty("fileSize")
|
||||
.map(createBy).toProperty("createBy")
|
||||
.map(createTime).toProperty("createTime")
|
||||
.map(updateBy).toProperty("updateBy")
|
||||
.map(updateTime).toProperty("updateTime")
|
||||
.map(remark).toProperty("remark")
|
||||
);
|
||||
}
|
||||
|
||||
default int insertSelective(SysFile row) {
|
||||
row.setCommonForInsert(SecurityUtilsExt.getUserIdStr());
|
||||
return MyBatis3Utils.insert(this::insert, row, sysFile, c ->
|
||||
c.map(fileId).toPropertyWhenPresent("fileId", row::getFileId)
|
||||
.map(savedName).toPropertyWhenPresent("savedName", row::getSavedName)
|
||||
.map(originalName).toPropertyWhenPresent("originalName", row::getOriginalName)
|
||||
.map(filePath).toPropertyWhenPresent("filePath", row::getFilePath)
|
||||
.map(extension).toPropertyWhenPresent("extension", row::getExtension)
|
||||
.map(storageType).toPropertyWhenPresent("storageType", row::getStorageType)
|
||||
.map(requestUrl).toPropertyWhenPresent("requestUrl", row::getRequestUrl)
|
||||
.map(fileSize).toPropertyWhenPresent("fileSize", row::getFileSize)
|
||||
.map(createBy).toPropertyWhenPresent("createBy", row::getCreateBy)
|
||||
.map(createTime).toPropertyWhenPresent("createTime", row::getCreateTime)
|
||||
.map(updateBy).toPropertyWhenPresent("updateBy", row::getUpdateBy)
|
||||
.map(updateTime).toPropertyWhenPresent("updateTime", row::getUpdateTime)
|
||||
.map(remark).toPropertyWhenPresent("remark", row::getRemark)
|
||||
);
|
||||
}
|
||||
|
||||
default Optional<SysFile> selectOne(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectOne(this::selectOne, selectList, sysFile, completer);
|
||||
}
|
||||
|
||||
default List<SysFile> select(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectList(this::selectMany, selectList, sysFile, completer);
|
||||
}
|
||||
|
||||
default List<SysFile> selectDistinct(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, sysFile, completer);
|
||||
}
|
||||
|
||||
default Optional<SysFile> selectByPrimaryKey(String fileId_) {
|
||||
return selectOne(c ->
|
||||
c.where(fileId, isEqualTo(fileId_))
|
||||
);
|
||||
}
|
||||
|
||||
default int update(UpdateDSLCompleter completer) {
|
||||
return MyBatis3Utils.update(this::update, sysFile, completer);
|
||||
}
|
||||
|
||||
static UpdateDSL<UpdateModel> updateAllColumns(SysFile row, UpdateDSL<UpdateModel> dsl) {
|
||||
return dsl.set(fileId).equalTo(row::getFileId)
|
||||
.set(savedName).equalTo(row::getSavedName)
|
||||
.set(originalName).equalTo(row::getOriginalName)
|
||||
.set(filePath).equalTo(row::getFilePath)
|
||||
.set(extension).equalTo(row::getExtension)
|
||||
.set(storageType).equalTo(row::getStorageType)
|
||||
.set(requestUrl).equalTo(row::getRequestUrl)
|
||||
.set(fileSize).equalTo(row::getFileSize)
|
||||
.set(createBy).equalTo(row::getCreateBy)
|
||||
.set(createTime).equalTo(row::getCreateTime)
|
||||
.set(updateBy).equalTo(row::getUpdateBy)
|
||||
.set(updateTime).equalTo(row::getUpdateTime)
|
||||
.set(remark).equalTo(row::getRemark);
|
||||
}
|
||||
|
||||
static UpdateDSL<UpdateModel> updateSelectiveColumns(SysFile row, UpdateDSL<UpdateModel> dsl) {
|
||||
row.setCommonForUpdate(SecurityUtilsExt.getUserIdStr());
|
||||
return dsl.set(fileId).equalToWhenPresent(row::getFileId)
|
||||
.set(savedName).equalToWhenPresent(row::getSavedName)
|
||||
.set(originalName).equalToWhenPresent(row::getOriginalName)
|
||||
.set(filePath).equalToWhenPresent(row::getFilePath)
|
||||
.set(extension).equalToWhenPresent(row::getExtension)
|
||||
.set(storageType).equalToWhenPresent(row::getStorageType)
|
||||
.set(requestUrl).equalToWhenPresent(row::getRequestUrl)
|
||||
.set(fileSize).equalToWhenPresent(row::getFileSize)
|
||||
.set(createBy).equalToWhenPresent(row::getCreateBy)
|
||||
.set(createTime).equalToWhenPresent(row::getCreateTime)
|
||||
.set(updateBy).equalToWhenPresent(row::getUpdateBy)
|
||||
.set(updateTime).equalToWhenPresent(row::getUpdateTime)
|
||||
.set(remark).equalToWhenPresent(row::getRemark);
|
||||
}
|
||||
|
||||
default int updateByPrimaryKey(SysFile row) {
|
||||
return update(c ->
|
||||
c.set(savedName).equalTo(row::getSavedName)
|
||||
.set(originalName).equalTo(row::getOriginalName)
|
||||
.set(filePath).equalTo(row::getFilePath)
|
||||
.set(extension).equalTo(row::getExtension)
|
||||
.set(storageType).equalTo(row::getStorageType)
|
||||
.set(requestUrl).equalTo(row::getRequestUrl)
|
||||
.set(fileSize).equalTo(row::getFileSize)
|
||||
.set(createBy).equalTo(row::getCreateBy)
|
||||
.set(createTime).equalTo(row::getCreateTime)
|
||||
.set(updateBy).equalTo(row::getUpdateBy)
|
||||
.set(updateTime).equalTo(row::getUpdateTime)
|
||||
.set(remark).equalTo(row::getRemark)
|
||||
.where(fileId, isEqualTo(row::getFileId))
|
||||
);
|
||||
}
|
||||
|
||||
default int updateByPrimaryKeySelective(SysFile row) {
|
||||
row.setCommonForUpdate(SecurityUtilsExt.getUserIdStr());
|
||||
return update(c ->
|
||||
c.set(savedName).equalToWhenPresent(row::getSavedName)
|
||||
.set(originalName).equalToWhenPresent(row::getOriginalName)
|
||||
.set(filePath).equalToWhenPresent(row::getFilePath)
|
||||
.set(extension).equalToWhenPresent(row::getExtension)
|
||||
.set(storageType).equalToWhenPresent(row::getStorageType)
|
||||
.set(requestUrl).equalToWhenPresent(row::getRequestUrl)
|
||||
.set(fileSize).equalToWhenPresent(row::getFileSize)
|
||||
.set(createBy).equalToWhenPresent(row::getCreateBy)
|
||||
.set(createTime).equalToWhenPresent(row::getCreateTime)
|
||||
.set(updateBy).equalToWhenPresent(row::getUpdateBy)
|
||||
.set(updateTime).equalToWhenPresent(row::getUpdateTime)
|
||||
.set(remark).equalToWhenPresent(row::getRemark)
|
||||
.where(fileId, isEqualTo(row::getFileId))
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user