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.constant;
|
||||
|
||||
/**
|
||||
* 缓存常量信息
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class CacheConstants
|
||||
{
|
||||
public class CacheConstants {
|
||||
/**
|
||||
* 缓存有效期,默认720(分钟)
|
||||
*/
|
||||
|
||||
@@ -1,48 +1,44 @@
|
||||
package com.ruoyi.common.redis.configure;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.SerializationException;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONReader;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
import com.alibaba.fastjson2.filter.Filter;
|
||||
import com.ruoyi.common.core.constant.Constants;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.SerializationException;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* Redis使用FastJson序列化
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
|
||||
{
|
||||
public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
|
||||
public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T> {
|
||||
public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
|
||||
|
||||
static final Filter AUTO_TYPE_FILTER = JSONReader.autoTypeFilter(Constants.JSON_WHITELIST_STR);
|
||||
|
||||
private Class<T> clazz;
|
||||
private final Class<T> clazz;
|
||||
|
||||
public FastJson2JsonRedisSerializer(Class<T> clazz)
|
||||
{
|
||||
public FastJson2JsonRedisSerializer(Class<T> clazz) {
|
||||
super();
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] serialize(T t) throws SerializationException
|
||||
{
|
||||
if (t == null)
|
||||
{
|
||||
public byte[] serialize(T t) throws SerializationException {
|
||||
if (t == null) {
|
||||
return new byte[0];
|
||||
}
|
||||
return JSON.toJSONString(t, JSONWriter.Feature.WriteClassName).getBytes(DEFAULT_CHARSET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T deserialize(byte[] bytes) throws SerializationException
|
||||
{
|
||||
if (bytes == null || bytes.length <= 0)
|
||||
{
|
||||
public T deserialize(byte[] bytes) throws SerializationException {
|
||||
if (bytes == null || bytes.length <= 0) {
|
||||
return null;
|
||||
}
|
||||
String str = new String(bytes, DEFAULT_CHARSET);
|
||||
|
||||
@@ -12,18 +12,16 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
/**
|
||||
* redis配置
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
@EnableCaching
|
||||
@AutoConfigureBefore(RedisAutoConfiguration.class)
|
||||
public class RedisConfig implements CachingConfigurer
|
||||
{
|
||||
public class RedisConfig implements CachingConfigurer {
|
||||
@Bean
|
||||
@SuppressWarnings(value = { "unchecked", "rawtypes" })
|
||||
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory)
|
||||
{
|
||||
@SuppressWarnings(value = {"unchecked", "rawtypes"})
|
||||
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
|
||||
RedisTemplate<Object, Object> template = new RedisTemplate<>();
|
||||
template.setConnectionFactory(connectionFactory);
|
||||
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package com.ruoyi.common.redis.service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.BoundSetOperations;
|
||||
import org.springframework.data.redis.core.HashOperations;
|
||||
@@ -13,64 +7,62 @@ import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.ValueOperations;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* spring redis 工具类
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
**/
|
||||
@SuppressWarnings(value = { "unchecked", "rawtypes" })
|
||||
@SuppressWarnings(value = {"unchecked", "rawtypes"})
|
||||
@Component
|
||||
public class RedisService
|
||||
{
|
||||
public class RedisService {
|
||||
@Autowired
|
||||
public RedisTemplate redisTemplate;
|
||||
|
||||
/**
|
||||
* 缓存基本的对象,Integer、String、实体类等
|
||||
*
|
||||
* @param key 缓存的键值
|
||||
* @param key 缓存的键值
|
||||
* @param value 缓存的值
|
||||
*/
|
||||
public <T> void setCacheObject(final String key, final T value)
|
||||
{
|
||||
public <T> void setCacheObject(final String key, final T value) {
|
||||
redisTemplate.opsForValue().set(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存基本的对象,Integer、String、实体类等
|
||||
*
|
||||
* @param key 缓存的键值
|
||||
* @param value 缓存的值
|
||||
* @param timeout 时间
|
||||
* @param key 缓存的键值
|
||||
* @param value 缓存的值
|
||||
* @param timeout 时间
|
||||
* @param timeUnit 时间颗粒度
|
||||
*/
|
||||
public <T> void setCacheObject(final String key, final T value, final Long timeout, final TimeUnit timeUnit)
|
||||
{
|
||||
public <T> void setCacheObject(final String key, final T value, final Long timeout, final TimeUnit timeUnit) {
|
||||
redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置有效时间
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param key Redis键
|
||||
* @param timeout 超时时间
|
||||
* @return true=设置成功;false=设置失败
|
||||
*/
|
||||
public boolean expire(final String key, final long timeout)
|
||||
{
|
||||
public boolean expire(final String key, final long timeout) {
|
||||
return expire(key, timeout, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置有效时间
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param key Redis键
|
||||
* @param timeout 超时时间
|
||||
* @param unit 时间单位
|
||||
* @param unit 时间单位
|
||||
* @return true=设置成功;false=设置失败
|
||||
*/
|
||||
public boolean expire(final String key, final long timeout, final TimeUnit unit)
|
||||
{
|
||||
public boolean expire(final String key, final long timeout, final TimeUnit unit) {
|
||||
return redisTemplate.expire(key, timeout, unit);
|
||||
}
|
||||
|
||||
@@ -80,8 +72,7 @@ public class RedisService
|
||||
* @param key Redis键
|
||||
* @return 有效时间
|
||||
*/
|
||||
public long getExpire(final String key)
|
||||
{
|
||||
public long getExpire(final String key) {
|
||||
return redisTemplate.getExpire(key);
|
||||
}
|
||||
|
||||
@@ -91,8 +82,7 @@ public class RedisService
|
||||
* @param key 键
|
||||
* @return true 存在 false不存在
|
||||
*/
|
||||
public Boolean hasKey(String key)
|
||||
{
|
||||
public Boolean hasKey(String key) {
|
||||
return redisTemplate.hasKey(key);
|
||||
}
|
||||
|
||||
@@ -102,19 +92,15 @@ public class RedisService
|
||||
* @param key 缓存键值
|
||||
* @return 缓存键值对应的数据
|
||||
*/
|
||||
public <T> T getCacheObject(final String key)
|
||||
{
|
||||
public <T> T getCacheObject(final String key) {
|
||||
ValueOperations<String, T> operation = redisTemplate.opsForValue();
|
||||
return operation.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单个对象
|
||||
*
|
||||
* @param key
|
||||
*/
|
||||
public boolean deleteObject(final String key)
|
||||
{
|
||||
public boolean deleteObject(final String key) {
|
||||
return redisTemplate.delete(key);
|
||||
}
|
||||
|
||||
@@ -122,22 +108,19 @@ public class RedisService
|
||||
* 删除集合对象
|
||||
*
|
||||
* @param collection 多个对象
|
||||
* @return
|
||||
*/
|
||||
public boolean deleteObject(final Collection collection)
|
||||
{
|
||||
public boolean deleteObject(final Collection collection) {
|
||||
return redisTemplate.delete(collection) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存List数据
|
||||
*
|
||||
* @param key 缓存的键值
|
||||
* @param key 缓存的键值
|
||||
* @param dataList 待缓存的List数据
|
||||
* @return 缓存的对象
|
||||
*/
|
||||
public <T> long setCacheList(final String key, final List<T> dataList)
|
||||
{
|
||||
public <T> long setCacheList(final String key, final List<T> dataList) {
|
||||
Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
|
||||
return count == null ? 0 : count;
|
||||
}
|
||||
@@ -148,48 +131,36 @@ public class RedisService
|
||||
* @param key 缓存的键值
|
||||
* @return 缓存键值对应的数据
|
||||
*/
|
||||
public <T> List<T> getCacheList(final String key)
|
||||
{
|
||||
public <T> List<T> getCacheList(final String key) {
|
||||
return redisTemplate.opsForList().range(key, 0, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存Set
|
||||
*
|
||||
* @param key 缓存键值
|
||||
* @param key 缓存键值
|
||||
* @param dataSet 缓存的数据
|
||||
* @return 缓存数据的对象
|
||||
*/
|
||||
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet)
|
||||
{
|
||||
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) {
|
||||
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
|
||||
Iterator<T> it = dataSet.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
setOperation.add(it.next());
|
||||
for (T t : dataSet) {
|
||||
setOperation.add(t);
|
||||
}
|
||||
return setOperation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得缓存的set
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public <T> Set<T> getCacheSet(final String key)
|
||||
{
|
||||
public <T> Set<T> getCacheSet(final String key) {
|
||||
return redisTemplate.opsForSet().members(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存Map
|
||||
*
|
||||
* @param key
|
||||
* @param dataMap
|
||||
*/
|
||||
public <T> void setCacheMap(final String key, final Map<String, T> dataMap)
|
||||
{
|
||||
public <T> void setCacheMap(final String key, final Map<String, T> dataMap) {
|
||||
if (dataMap != null) {
|
||||
redisTemplate.opsForHash().putAll(key, dataMap);
|
||||
}
|
||||
@@ -197,36 +168,30 @@ public class RedisService
|
||||
|
||||
/**
|
||||
* 获得缓存的Map
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public <T> Map<String, T> getCacheMap(final String key)
|
||||
{
|
||||
public <T> Map<String, T> getCacheMap(final String key) {
|
||||
return redisTemplate.opsForHash().entries(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 往Hash中存入数据
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param hKey Hash键
|
||||
* @param key Redis键
|
||||
* @param hKey Hash键
|
||||
* @param value 值
|
||||
*/
|
||||
public <T> void setCacheMapValue(final String key, final String hKey, final T value)
|
||||
{
|
||||
public <T> void setCacheMapValue(final String key, final String hKey, final T value) {
|
||||
redisTemplate.opsForHash().put(key, hKey, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Hash中的数据
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param key Redis键
|
||||
* @param hKey Hash键
|
||||
* @return Hash中的对象
|
||||
*/
|
||||
public <T> T getCacheMapValue(final String key, final String hKey)
|
||||
{
|
||||
public <T> T getCacheMapValue(final String key, final String hKey) {
|
||||
HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
|
||||
return opsForHash.get(key, hKey);
|
||||
}
|
||||
@@ -234,24 +199,22 @@ public class RedisService
|
||||
/**
|
||||
* 获取多个Hash中的数据
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param key Redis键
|
||||
* @param hKeys Hash键集合
|
||||
* @return Hash对象集合
|
||||
*/
|
||||
public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys)
|
||||
{
|
||||
public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) {
|
||||
return redisTemplate.opsForHash().multiGet(key, hKeys);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除Hash中的某条数据
|
||||
*
|
||||
* @param key Redis键
|
||||
* @param key Redis键
|
||||
* @param hKey Hash键
|
||||
* @return 是否成功
|
||||
*/
|
||||
public boolean deleteCacheMapValue(final String key, final String hKey)
|
||||
{
|
||||
public boolean deleteCacheMapValue(final String key, final String hKey) {
|
||||
return redisTemplate.opsForHash().delete(key, hKey) > 0;
|
||||
}
|
||||
|
||||
@@ -261,8 +224,7 @@ public class RedisService
|
||||
* @param pattern 字符串前缀
|
||||
* @return 对象列表
|
||||
*/
|
||||
public Collection<String> keys(final String pattern)
|
||||
{
|
||||
public Collection<String> keys(final String pattern) {
|
||||
return redisTemplate.keys(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.common.services.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
@@ -25,46 +26,55 @@ public class SysSeqRule extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 序列号识别码
|
||||
*/
|
||||
@Excel(name = "序列号识别码")
|
||||
private String seqDistCd;
|
||||
|
||||
/**
|
||||
* 规则名称
|
||||
*/
|
||||
@Excel(name = "规则名称")
|
||||
private String ruleName;
|
||||
|
||||
/**
|
||||
* 前缀
|
||||
*/
|
||||
@Excel(name = "前缀")
|
||||
private String prefix;
|
||||
|
||||
/**
|
||||
* 分隔符1
|
||||
*/
|
||||
@Excel(name = "分隔符1")
|
||||
private String separator1;
|
||||
|
||||
/**
|
||||
* 日期格式
|
||||
*/
|
||||
@Excel(name = "日期格式")
|
||||
private String dateFormat;
|
||||
|
||||
/**
|
||||
* 序列号数字部分的最小位数,不足补0
|
||||
*/
|
||||
@Excel(name = "最小位数")
|
||||
private Integer minDigits;
|
||||
|
||||
/**
|
||||
* 分隔符2
|
||||
*/
|
||||
@Excel(name = "分隔符2")
|
||||
private String separator2;
|
||||
|
||||
/**
|
||||
* 生成器名称(或类全名),自定义的生成器可忽略前面的规则自行生成
|
||||
*/
|
||||
@Excel(name = "生成器名")
|
||||
private String generatorName;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Excel(name = "是否启用")
|
||||
private Integer enableFlag;
|
||||
|
||||
/**
|
||||
@@ -95,6 +105,10 @@ public class SysSeqRule extends BaseEntity implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enableFlag != null && enableFlag == 1;
|
||||
}
|
||||
|
||||
public Long getRuleId() {
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,215 +0,0 @@
|
||||
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