mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2026-02-06 01:34:25 +08:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36de38fda3 | ||
|
|
efff2dd6d2 | ||
|
|
69ebb583a4 | ||
|
|
843823188b | ||
|
|
97827c4d27 | ||
|
|
38a92824ba | ||
|
|
bf8311c296 | ||
|
|
686f6ac9a3 | ||
|
|
63ef235b95 | ||
|
|
3ceea05ba1 | ||
|
|
9fda0a7bd6 | ||
|
|
9361097097 | ||
|
|
942c628cc6 | ||
|
|
521b98746f | ||
|
|
4229ec80b0 | ||
|
|
4582656e27 | ||
|
|
fff0120058 | ||
|
|
b8f2200af6 | ||
|
|
0a56497b51 | ||
|
|
2eb3742063 | ||
|
|
74aa2da89b | ||
|
|
3dcad0b78a | ||
|
|
6ba6b18849 |
@@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
**<font color="#DC143C">国内首个满足《网络安全-三级等保》、《数据安全》</font>** 功能要求,支持登录限制、接口国产加解密、数据脱敏等一系列安全要求。
|
**<font color="#DC143C">国内首个满足《网络安全-三级等保》、《数据安全》</font>** 功能要求,支持登录限制、接口国产加解密、数据脱敏等一系列安全要求。
|
||||||
|
|
||||||
**<font color="#DC143C">支持国产数据库:达梦、金仓、南大通用、OceanBase、GaussDB 高斯、阿里PolarDB、GoldenDB。 </font>**
|
**<font color="#DC143C">支持国产数据库:【达梦、金仓、南大通用、海量数据、神州通用、OceanBase、GaussDB 高斯、阿里PolarDB、GoldenDB】等,主流数据库:【Mysql、PostgreSQL、SqlServer、Oracle】等</font>**
|
||||||
|
|
||||||
前端提供 **<font color="#DC143C">JavaScript和TypeScript双版本</font>**,后端提供 **<font color="#DC143C">Java8+SpringBoot2.X和Java17+SpringBoot3.X 双版本</font>**。
|
**<font color="#DC143C">前端提供JavaScript和TypeScript双版本,后端提供Java8+SpringBoot2.X和Java17+SpringBoot3.X 双版本</font>**。
|
||||||
|
|
||||||
同时 **<font color="#DC143C">重磅开源</font>** 开源六年来 **<font color="#DC143C">千余家企业验证过且正在使用</font>** 的代码规范: **<font color="#DC143C">《高质量代码思想》、《Vue3规范》、《Java规范》</font>** ,让大家在这浮躁的世界里感受到一股把代码写好的清流!同时又能节省大量时间,减少加班,快乐工作,保持谦逊,保持学习,**<font color="#DC143C">热爱代码,更热爱生活</font>** !
|
同时 **<font color="#DC143C">重磅开源</font>** 开源六年来 **<font color="#DC143C">千余家企业验证过且正在使用</font>** 的代码规范: **<font color="#DC143C">《高质量代码思想》、《Vue3规范》、《Java规范》</font>** ,让大家在这浮躁的世界里感受到一股把代码写好的清流!同时又能节省大量时间,减少加班,快乐工作,保持谦逊,保持学习,**<font color="#DC143C">热爱代码,更热爱生活</font>** !
|
||||||
### **技术体系**
|
### **技术体系**
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ public class DepartmentEntity {
|
|||||||
/**
|
/**
|
||||||
* 负责人员工 id
|
* 负责人员工 id
|
||||||
*/
|
*/
|
||||||
@TableField(updateStrategy = FieldStrategy.NEVER)
|
|
||||||
private Long managerId;
|
private Long managerId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -274,12 +274,12 @@ public class EmployeeService {
|
|||||||
if (null == employeeEntity) {
|
if (null == employeeEntity) {
|
||||||
return ResponseDTO.error(UserErrorCode.DATA_NOT_EXIST);
|
return ResponseDTO.error(UserErrorCode.DATA_NOT_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新禁用状态
|
||||||
employeeDao.updateDisableFlag(employeeId, !employeeEntity.getDisabledFlag());
|
employeeDao.updateDisableFlag(employeeId, !employeeEntity.getDisabledFlag());
|
||||||
|
|
||||||
if (employeeEntity.getDisabledFlag()) {
|
// 强制退出登录
|
||||||
// 强制退出登录
|
StpUtil.logout(UserTypeEnum.ADMIN_EMPLOYEE.getValue() + StringConst.COLON + employeeId);
|
||||||
StpUtil.logout(UserTypeEnum.ADMIN_EMPLOYEE.getValue() + StringConst.COLON + employeeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ResponseDTO.ok();
|
return ResponseDTO.ok();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,8 +153,19 @@ public class LoginManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@CacheEvict(value = {AdminCacheConst.Login.USER_PERMISSION, AdminCacheConst.Login.REQUEST_EMPLOYEE}, allEntries = true)
|
/**
|
||||||
public void clear(){
|
* 清除用户权限
|
||||||
|
*/
|
||||||
|
@CacheEvict(value = AdminCacheConst.Login.USER_PERMISSION)
|
||||||
|
public void clearUserPermission(Long employeeId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除用户登录信息
|
||||||
|
*/
|
||||||
|
@CacheEvict(value = AdminCacheConst.Login.REQUEST_EMPLOYEE)
|
||||||
|
public void clearUserLoginInfo(Long employeeId) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -317,8 +317,8 @@ public class LoginService implements StpInterface {
|
|||||||
// sa token 登出
|
// sa token 登出
|
||||||
StpUtil.logout();
|
StpUtil.logout();
|
||||||
|
|
||||||
// 清空登录信息缓存
|
// 清除用户登录信息缓存和权限信息
|
||||||
loginManager.clear();
|
this.clearLoginEmployeeCache(requestUser.getUserId());
|
||||||
|
|
||||||
//保存登出日志
|
//保存登出日志
|
||||||
LoginLogEntity loginEntity = LoginLogEntity.builder()
|
LoginLogEntity loginEntity = LoginLogEntity.builder()
|
||||||
@@ -474,6 +474,7 @@ public class LoginService implements StpInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clearLoginEmployeeCache(Long employeeId) {
|
public void clearLoginEmployeeCache(Long employeeId) {
|
||||||
loginManager.clear();
|
loginManager.clearUserPermission(employeeId);
|
||||||
|
loginManager.clearUserLoginInfo(employeeId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
SELECT * FROM t_goods
|
SELECT * FROM t_goods
|
||||||
<where>
|
<where>
|
||||||
<if test="query.searchWord != null and query.searchWord !=''">
|
<if test="query.searchWord != null and query.searchWord !=''">
|
||||||
INSTR(goods_name,#{query.searchWord})
|
AND INSTR(goods_name,#{query.searchWord})
|
||||||
</if>
|
</if>
|
||||||
<if test="query.place != null">
|
<if test="query.place != null">
|
||||||
AND INSTR(place,#{query.place})
|
AND INSTR(place,#{query.place})
|
||||||
|
|||||||
@@ -20,17 +20,25 @@ public class LongJsonSerializer extends JsonSerializer<Long> {
|
|||||||
|
|
||||||
public static final LongJsonSerializer INSTANCE = new LongJsonSerializer();
|
public static final LongJsonSerializer INSTANCE = new LongJsonSerializer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JS 安全整数范围
|
||||||
|
* 根据 JS Number.MIN_SAFE_INTEGER 与 Number.MAX_SAFE_INTEGER 得来
|
||||||
|
*/
|
||||||
|
private static final long JS_MIN_SAFE_INTEGER = -9007199254740991L;
|
||||||
|
private static final long JS_MAX_SAFE_INTEGER = 9007199254740991L;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(Long value, JsonGenerator gen, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
|
public void serialize(Long value, JsonGenerator gen, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
|
||||||
if (null == value) {
|
if (null == value) {
|
||||||
gen.writeNull();
|
gen.writeNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// js中最大安全整数16位 Number.MAX_SAFE_INTEGER
|
// 如果超出了 JavaScript 安全整数范围,则序列化为字符串
|
||||||
String longStr = String.valueOf(value);
|
if (value < JS_MIN_SAFE_INTEGER || value > JS_MAX_SAFE_INTEGER) {
|
||||||
if (longStr.length() > 16) {
|
gen.writeString(Long.toString(value));
|
||||||
gen.writeString(longStr);
|
|
||||||
} else {
|
} else {
|
||||||
|
// 否则,序列化为数字
|
||||||
gen.writeNumber(value);
|
gen.writeNumber(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,48 +5,69 @@ import jakarta.annotation.Resource;
|
|||||||
import net.lab1024.sa.base.module.support.cache.CacheService;
|
import net.lab1024.sa.base.module.support.cache.CacheService;
|
||||||
import net.lab1024.sa.base.module.support.cache.CaffeineCacheServiceImpl;
|
import net.lab1024.sa.base.module.support.cache.CaffeineCacheServiceImpl;
|
||||||
import net.lab1024.sa.base.module.support.cache.RedisCacheServiceImpl;
|
import net.lab1024.sa.base.module.support.cache.RedisCacheServiceImpl;
|
||||||
|
import net.lab1024.sa.base.module.support.redis.CustomRedisCacheManager;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.cache.CacheManager;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
||||||
|
import org.springframework.data.redis.cache.RedisCacheWriter;
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
import org.springframework.data.redis.serializer.RedisSerializationContext;
|
import org.springframework.data.redis.serializer.RedisSerializationContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存配置
|
* 缓存配置
|
||||||
*
|
*
|
||||||
* @author zhoumingfa
|
|
||||||
* @date 2025/03/28
|
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class CacheConfig {
|
public class CacheConfig {
|
||||||
|
|
||||||
private static final String REDIS_CACHE = "redis";
|
private static final String REDIS_CACHE = "redis";
|
||||||
|
|
||||||
private static final String CAFFEINE_CACHE = "caffeine";
|
private static final String CAFFEINE_CACHE = "caffeine";
|
||||||
|
|
||||||
|
public static final String REDIS_CACHE_PREFIX = "cache";
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RedisConnectionFactory factory;
|
private RedisConnectionFactory redisConnectionFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建自定义Redis缓存管理器Bean 整合spring-cache
|
||||||
|
* Redis连接工厂,用于建立与Redis服务器的连接
|
||||||
|
*
|
||||||
|
* @return CacheManager Redis缓存管理器实例
|
||||||
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = REDIS_CACHE)
|
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = REDIS_CACHE)
|
||||||
public RedisCacheConfiguration redisCacheConfiguration() {
|
public CacheManager cacheManager() {
|
||||||
return RedisCacheConfiguration.defaultCacheConfig()
|
// 使用非阻塞模式的缓存写入器,适用于大多数高并发场景
|
||||||
|
RedisCacheWriter redisCacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(redisConnectionFactory);
|
||||||
|
|
||||||
|
// 构建默认缓存配置
|
||||||
|
RedisCacheConfiguration defaultCacheConfig = RedisCacheConfiguration.defaultCacheConfig()
|
||||||
|
// 禁止缓存 null 值,避免缓存穿透
|
||||||
.disableCachingNullValues()
|
.disableCachingNullValues()
|
||||||
.computePrefixWith(name -> "cache:" + name + ":")
|
.computePrefixWith(name -> REDIS_CACHE_PREFIX + name + ":")
|
||||||
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new GenericFastJsonRedisSerializer()));
|
// 使用 FastJSON 序列化缓存值,支持复杂对象
|
||||||
|
.serializeValuesWith(RedisSerializationContext.SerializationPair
|
||||||
|
.fromSerializer(new GenericFastJsonRedisSerializer()));
|
||||||
|
|
||||||
|
// 返回自定义缓存管理器,支持 cacheName#ttl 格式与永久缓存(#-1)
|
||||||
|
return new CustomRedisCacheManager(redisCacheWriter, defaultCacheConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = REDIS_CACHE)
|
|
||||||
public CacheService redisCacheService() {
|
|
||||||
return new RedisCacheServiceImpl();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = CAFFEINE_CACHE)
|
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = REDIS_CACHE)
|
||||||
public CacheService caffeineCacheService() {
|
public CacheService redisCacheService() {
|
||||||
return new CaffeineCacheServiceImpl();
|
return new RedisCacheServiceImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = CAFFEINE_CACHE)
|
||||||
|
public CacheService caffeineCacheService() {
|
||||||
|
return new CaffeineCacheServiceImpl();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ public class FileConfig implements WebMvcConfigurer {
|
|||||||
StaticCredentialsProvider.create(
|
StaticCredentialsProvider.create(
|
||||||
AwsBasicCredentials.create(accessKey, secretKey)))
|
AwsBasicCredentials.create(accessKey, secretKey)))
|
||||||
.serviceConfiguration(S3Configuration.builder()
|
.serviceConfiguration(S3Configuration.builder()
|
||||||
.pathStyleAccessEnabled(true)
|
.pathStyleAccessEnabled(false)
|
||||||
.chunkedEncodingEnabled(false)
|
.chunkedEncodingEnabled(false)
|
||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.lab1024.sa.base.config;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||||
@@ -13,6 +14,8 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.BigInteger;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeParseException;
|
import java.time.format.DateTimeParseException;
|
||||||
@@ -37,6 +40,9 @@ public class JsonConfig {
|
|||||||
builder.serializers(new LocalDateSerializer(DatePattern.NORM_DATE_FORMAT.getDateTimeFormatter()));
|
builder.serializers(new LocalDateSerializer(DatePattern.NORM_DATE_FORMAT.getDateTimeFormatter()));
|
||||||
builder.serializers(new LocalDateTimeSerializer(DatePattern.NORM_DATETIME_FORMAT.getDateTimeFormatter()));
|
builder.serializers(new LocalDateTimeSerializer(DatePattern.NORM_DATETIME_FORMAT.getDateTimeFormatter()));
|
||||||
builder.serializerByType(Long.class, LongJsonSerializer.INSTANCE);
|
builder.serializerByType(Long.class, LongJsonSerializer.INSTANCE);
|
||||||
|
builder.serializerByType(Long.TYPE, LongJsonSerializer.INSTANCE);
|
||||||
|
builder.serializerByType(BigInteger.class, ToStringSerializer.instance);
|
||||||
|
builder.serializerByType(BigDecimal.class, ToStringSerializer.instance);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.lab1024.sa.base.module.support.cache;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import net.lab1024.sa.base.config.CacheConfig;
|
||||||
import net.lab1024.sa.base.constant.ReloadConst;
|
import net.lab1024.sa.base.constant.ReloadConst;
|
||||||
import net.lab1024.sa.base.module.support.reload.core.annoation.SmartReload;
|
import net.lab1024.sa.base.module.support.reload.core.annoation.SmartReload;
|
||||||
import org.springframework.data.redis.cache.RedisCache;
|
import org.springframework.data.redis.cache.RedisCache;
|
||||||
@@ -49,7 +50,7 @@ public class RedisCacheServiceImpl implements CacheService {
|
|||||||
// 获取 Redis 连接
|
// 获取 Redis 连接
|
||||||
RedisConnection connection = redisConnectionFactory.getConnection();
|
RedisConnection connection = redisConnectionFactory.getConnection();
|
||||||
// 根据指定的 key 模式获取所有匹配的键
|
// 根据指定的 key 模式获取所有匹配的键
|
||||||
Set<byte[]> keys = connection.keyCommands().keys((cacheName + ":*").getBytes());
|
Set<byte[]> keys = connection.keyCommands().keys((CacheConfig.REDIS_CACHE_PREFIX + ":" + cacheName + "*").getBytes());
|
||||||
|
|
||||||
if (keys != null) {
|
if (keys != null) {
|
||||||
return keys.stream().map(key -> {
|
return keys.stream().map(key -> {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class DictDataVO implements Serializable {
|
|||||||
private String dictName;
|
private String dictName;
|
||||||
|
|
||||||
@Schema(description = "字典禁用状态")
|
@Schema(description = "字典禁用状态")
|
||||||
private Integer dictDisabledFlag;
|
private Boolean dictDisabledFlag;
|
||||||
|
|
||||||
@Schema(description = "字典项值")
|
@Schema(description = "字典项值")
|
||||||
private String dataValue;
|
private String dataValue;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class DictVO {
|
|||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
@Schema(description = "禁用状态")
|
@Schema(description = "禁用状态")
|
||||||
private Integer disabledFlag;
|
private Boolean disabledFlag;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ public class FileStorageLocalServiceImpl implements IFileStorageService {
|
|||||||
// 目录不存在,新建
|
// 目录不存在,新建
|
||||||
directory.mkdirs();
|
directory.mkdirs();
|
||||||
}
|
}
|
||||||
if (!path.endsWith("/")) {
|
if (!path.endsWith(File.separator)) {
|
||||||
path = path + "/";
|
path = path + File.separator;
|
||||||
}
|
}
|
||||||
FileUploadVO fileUploadVO = new FileUploadVO();
|
FileUploadVO fileUploadVO = new FileUploadVO();
|
||||||
//原文件名
|
//原文件名
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ package net.lab1024.sa.base.module.support.loginlog.domain;
|
|||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@@ -20,6 +22,8 @@ import java.time.LocalDateTime;
|
|||||||
@TableName("t_login_log")
|
@TableName("t_login_log")
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class LoginLogEntity {
|
public class LoginLogEntity {
|
||||||
|
|
||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
|
|||||||
@@ -0,0 +1,145 @@
|
|||||||
|
package net.lab1024.sa.base.module.support.redis;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.boot.convert.DurationStyle;
|
||||||
|
import org.springframework.data.redis.cache.*;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
|
||||||
|
import static net.lab1024.sa.base.common.constant.StringConst.COLON;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义 RedisCacheManager,支持在 cacheName 中通过 '#' 指定 TTL(过期时间)。
|
||||||
|
*
|
||||||
|
* @Author CoderKK
|
||||||
|
* @Date 2025-08-15 13:01:01
|
||||||
|
* <p>
|
||||||
|
* 支持格式:{@code cacheName#ttl},其中 ttl 支持 Spring 的 Duration 格式。
|
||||||
|
* 特殊值:{@code -1} 表示永久缓存(永不过期)。
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <h3>使用示例:</h3>
|
||||||
|
* <pre>
|
||||||
|
* // 10 秒后过期
|
||||||
|
* @Cacheable(value = "user#10s", key = "#id")
|
||||||
|
* // 2 小时后过期
|
||||||
|
* @Cacheable(value = "report#2h", key = "#date")
|
||||||
|
* // 30 分钟后过期
|
||||||
|
* @Cacheable(value = "session#30m", key = "#token")
|
||||||
|
* // 永不过期(永久缓存),适用于极少变化的配置数据
|
||||||
|
* @Cacheable(value = "appConfig#-1", key = "'globalSettings'")
|
||||||
|
* // 无 TTL,使用全局默认过期时间(如 7 天)
|
||||||
|
* @Cacheable(value = "product", key = "#productId")
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <h3>生成的 Redis Key 格式:</h3>
|
||||||
|
* <pre>
|
||||||
|
* cache:cacheName:key
|
||||||
|
* 例如:cache:user:123
|
||||||
|
* cache:appConfig:globalSettings
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <h3>支持的 TTL 单位:</h3>
|
||||||
|
* <ul>
|
||||||
|
* <li>{@code ms} / {@code millis} / {@code milliseconds} - 毫秒</li>
|
||||||
|
* <li>{@code s} / {@code secs} / {@code seconds} - 秒</li>
|
||||||
|
* <li>{@code m} / {@code mins} / {@code minutes} - 分钟</li>
|
||||||
|
* <li>{@code h} / {@code hrs} / {@code hours} - 小时</li>
|
||||||
|
* <li>{@code d} / {@code days} - 天</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* <h3>注意事项:</h3>
|
||||||
|
* <ul>
|
||||||
|
* <li>不写单位默认为毫秒</li>
|
||||||
|
* <li>永久缓存(#-1)不会自动过期,请配合 @CacheEvict 手动清理。</li>
|
||||||
|
* <li>避免对频繁更新的数据使用永久缓存,防止数据陈旧。</li>
|
||||||
|
* <li>cacheName 中的 '#' 只解析第一个,后续字符将作为 TTL 处理。</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class CustomRedisCacheManager extends RedisCacheManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存全局前缀
|
||||||
|
*/
|
||||||
|
private static final String CACHE_PREFIX = "cache";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义 TTL 分隔符,用于在 cacheName 后附加过期时间
|
||||||
|
*/
|
||||||
|
private static final String CUSTOM_TTL_SEPARATOR = "#";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认缓存过期时间:7 天
|
||||||
|
*/
|
||||||
|
private static final Duration DEFAULT_TTL = Duration.ofDays(7);
|
||||||
|
|
||||||
|
public CustomRedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration) {
|
||||||
|
super(cacheWriter, defaultCacheConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建 RedisCache 实例,支持从 cacheName 解析 TTL
|
||||||
|
*
|
||||||
|
* @param name 缓存名称(支持 name#ttl 格式)
|
||||||
|
* @param cacheConfig 默认缓存配置
|
||||||
|
* @return RedisCache
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected RedisCache createRedisCache(String name, RedisCacheConfiguration cacheConfig) {
|
||||||
|
Duration ttl = parseTtlFromCacheName(name);
|
||||||
|
if (ttl == null) {
|
||||||
|
ttl = DEFAULT_TTL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CacheKeyPrefix keyPrefix = cacheName -> {
|
||||||
|
if (StrUtil.isBlank(cacheName)) {
|
||||||
|
return CACHE_PREFIX + COLON;
|
||||||
|
}
|
||||||
|
String[] parts = cacheName.split(CUSTOM_TTL_SEPARATOR, 2);
|
||||||
|
String cleanName = StrUtil.trim(parts[0]);
|
||||||
|
return CACHE_PREFIX + COLON + cleanName + COLON;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 构建最终缓存配置:设置 key 前缀 + TTL
|
||||||
|
RedisCacheConfiguration config = cacheConfig.computePrefixWith(keyPrefix).entryTtl(ttl);
|
||||||
|
|
||||||
|
return super.createRedisCache(name, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从 cacheName 中解析 TTL
|
||||||
|
*
|
||||||
|
* @param name 缓存名称,格式如:users#10m, products#2h, config#-1(永久)
|
||||||
|
* @return 解析出的 Duration若无效则返回 null;若为 -1,则返回 Duration.ofMillis(-1) 表示永久缓存
|
||||||
|
*/
|
||||||
|
private Duration parseTtlFromCacheName(String name) {
|
||||||
|
if (StrUtil.isBlank(name)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] parts = name.split(CUSTOM_TTL_SEPARATOR, 2);
|
||||||
|
if (parts.length < 2) {
|
||||||
|
return null; // 无 TTL 部分
|
||||||
|
}
|
||||||
|
|
||||||
|
String ttlStr = StrUtil.trim(parts[1]);
|
||||||
|
if (StrUtil.isBlank(ttlStr)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 特殊处理:-1 表示永久缓存
|
||||||
|
if ("-1".equals(ttlStr)) {
|
||||||
|
return Duration.ofMillis(-1); // Spring Redis 中负数 Duration 表示永不过期
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Duration ttl = DurationStyle.detectAndParse(ttlStr);
|
||||||
|
return ttl.getSeconds() > 0 ? ttl : null;
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
log.error("解析缓存 TTL 失败,cacheName='{}', ttl='{}', 错误: {}", name, ttlStr, e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,8 +3,10 @@ package net.lab1024.sa.base.module.support.securityprotect.domain;
|
|||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@@ -21,6 +23,8 @@ import java.time.LocalDateTime;
|
|||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
@TableName("t_login_fail")
|
@TableName("t_login_fail")
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class LoginFailEntity {
|
public class LoginFailEntity {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ public class DepartmentEntity {
|
|||||||
/**
|
/**
|
||||||
* 负责人员工 id
|
* 负责人员工 id
|
||||||
*/
|
*/
|
||||||
@TableField(updateStrategy = FieldStrategy.NEVER)
|
|
||||||
private Long managerId;
|
private Long managerId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -275,12 +275,12 @@ public class EmployeeService {
|
|||||||
if (null == employeeEntity) {
|
if (null == employeeEntity) {
|
||||||
return ResponseDTO.error(UserErrorCode.DATA_NOT_EXIST);
|
return ResponseDTO.error(UserErrorCode.DATA_NOT_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新禁用状态
|
||||||
employeeDao.updateDisableFlag(employeeId, !employeeEntity.getDisabledFlag());
|
employeeDao.updateDisableFlag(employeeId, !employeeEntity.getDisabledFlag());
|
||||||
|
|
||||||
if (employeeEntity.getDisabledFlag()) {
|
// 强制退出登录
|
||||||
// 强制退出登录
|
StpUtil.logout(UserTypeEnum.ADMIN_EMPLOYEE.getValue() + StringConst.COLON + employeeId);
|
||||||
StpUtil.logout(UserTypeEnum.ADMIN_EMPLOYEE.getValue() + StringConst.COLON + employeeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ResponseDTO.ok();
|
return ResponseDTO.ok();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,8 +153,19 @@ public class LoginManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@CacheEvict(value = {AdminCacheConst.Login.USER_PERMISSION, AdminCacheConst.Login.REQUEST_EMPLOYEE}, allEntries = true)
|
/**
|
||||||
public void clear(){
|
* 清除用户权限
|
||||||
|
*/
|
||||||
|
@CacheEvict(value = AdminCacheConst.Login.USER_PERMISSION)
|
||||||
|
public void clearUserPermission(Long employeeId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除用户登录信息
|
||||||
|
*/
|
||||||
|
@CacheEvict(value = AdminCacheConst.Login.REQUEST_EMPLOYEE)
|
||||||
|
public void clearUserLoginInfo(Long employeeId) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -319,8 +319,8 @@ public class LoginService implements StpInterface {
|
|||||||
// sa token 登出
|
// sa token 登出
|
||||||
StpUtil.logout();
|
StpUtil.logout();
|
||||||
|
|
||||||
// 清空登录信息缓存
|
// 清除用户登录信息缓存和权限信息
|
||||||
loginManager.clear();
|
this.clearLoginEmployeeCache(requestUser.getUserId());
|
||||||
|
|
||||||
//保存登出日志
|
//保存登出日志
|
||||||
LoginLogEntity loginEntity = LoginLogEntity.builder()
|
LoginLogEntity loginEntity = LoginLogEntity.builder()
|
||||||
@@ -476,6 +476,7 @@ public class LoginService implements StpInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clearLoginEmployeeCache(Long employeeId) {
|
public void clearLoginEmployeeCache(Long employeeId) {
|
||||||
loginManager.clear();
|
loginManager.clearUserPermission(employeeId);
|
||||||
|
loginManager.clearUserLoginInfo(employeeId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
SELECT * FROM t_goods
|
SELECT * FROM t_goods
|
||||||
<where>
|
<where>
|
||||||
<if test="query.searchWord != null and query.searchWord !=''">
|
<if test="query.searchWord != null and query.searchWord !=''">
|
||||||
INSTR(goods_name,#{query.searchWord})
|
AND INSTR(goods_name,#{query.searchWord})
|
||||||
</if>
|
</if>
|
||||||
<if test="query.place != null">
|
<if test="query.place != null">
|
||||||
AND INSTR(place,#{query.place})
|
AND INSTR(place,#{query.place})
|
||||||
|
|||||||
@@ -20,17 +20,25 @@ public class LongJsonSerializer extends JsonSerializer<Long> {
|
|||||||
|
|
||||||
public static final LongJsonSerializer INSTANCE = new LongJsonSerializer();
|
public static final LongJsonSerializer INSTANCE = new LongJsonSerializer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JS 安全整数范围
|
||||||
|
* 根据 JS Number.MIN_SAFE_INTEGER 与 Number.MAX_SAFE_INTEGER 得来
|
||||||
|
*/
|
||||||
|
private static final long JS_MIN_SAFE_INTEGER = -9007199254740991L;
|
||||||
|
private static final long JS_MAX_SAFE_INTEGER = 9007199254740991L;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(Long value, JsonGenerator gen, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
|
public void serialize(Long value, JsonGenerator gen, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
|
||||||
if (null == value) {
|
if (null == value) {
|
||||||
gen.writeNull();
|
gen.writeNull();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// js中最大安全整数16位 Number.MAX_SAFE_INTEGER
|
// 如果超出了 JavaScript 安全整数范围,则序列化为字符串
|
||||||
String longStr = String.valueOf(value);
|
if (value < JS_MIN_SAFE_INTEGER || value > JS_MAX_SAFE_INTEGER) {
|
||||||
if (longStr.length() > 16) {
|
gen.writeString(Long.toString(value));
|
||||||
gen.writeString(longStr);
|
|
||||||
} else {
|
} else {
|
||||||
|
// 否则,序列化为数字
|
||||||
gen.writeNumber(value);
|
gen.writeNumber(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,13 @@ import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer;
|
|||||||
import net.lab1024.sa.base.module.support.cache.CacheService;
|
import net.lab1024.sa.base.module.support.cache.CacheService;
|
||||||
import net.lab1024.sa.base.module.support.cache.CaffeineCacheServiceImpl;
|
import net.lab1024.sa.base.module.support.cache.CaffeineCacheServiceImpl;
|
||||||
import net.lab1024.sa.base.module.support.cache.RedisCacheServiceImpl;
|
import net.lab1024.sa.base.module.support.cache.RedisCacheServiceImpl;
|
||||||
|
import net.lab1024.sa.base.module.support.redis.CustomRedisCacheManager;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.cache.CacheManager;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
||||||
|
import org.springframework.data.redis.cache.RedisCacheWriter;
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
import org.springframework.data.redis.serializer.RedisSerializationContext;
|
import org.springframework.data.redis.serializer.RedisSerializationContext;
|
||||||
|
|
||||||
@@ -16,28 +19,46 @@ import javax.annotation.Resource;
|
|||||||
/**
|
/**
|
||||||
* 缓存配置
|
* 缓存配置
|
||||||
*
|
*
|
||||||
* @author zhoumingfa
|
|
||||||
* @date 2025/03/28
|
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class CacheConfig {
|
public class CacheConfig {
|
||||||
|
|
||||||
private static final String REDIS_CACHE = "redis";
|
private static final String REDIS_CACHE = "redis";
|
||||||
|
|
||||||
private static final String CAFFEINE_CACHE = "caffeine";
|
private static final String CAFFEINE_CACHE = "caffeine";
|
||||||
|
|
||||||
|
public static final String REDIS_CACHE_PREFIX = "cache";
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RedisConnectionFactory factory;
|
private RedisConnectionFactory redisConnectionFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建自定义Redis缓存管理器Bean 整合spring-cache
|
||||||
|
* Redis连接工厂,用于建立与Redis服务器的连接
|
||||||
|
*
|
||||||
|
* @return CacheManager Redis缓存管理器实例
|
||||||
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = REDIS_CACHE)
|
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = REDIS_CACHE)
|
||||||
public RedisCacheConfiguration redisCacheConfiguration() {
|
public CacheManager cacheManager() {
|
||||||
return RedisCacheConfiguration.defaultCacheConfig()
|
// 使用非阻塞模式的缓存写入器,适用于大多数高并发场景
|
||||||
|
RedisCacheWriter redisCacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(redisConnectionFactory);
|
||||||
|
|
||||||
|
// 构建默认缓存配置
|
||||||
|
RedisCacheConfiguration defaultCacheConfig = RedisCacheConfiguration.defaultCacheConfig()
|
||||||
|
// 禁止缓存 null 值,避免缓存穿透
|
||||||
.disableCachingNullValues()
|
.disableCachingNullValues()
|
||||||
.computePrefixWith(name -> "cache:" + name + ":")
|
.computePrefixWith(name -> REDIS_CACHE_PREFIX + name + ":")
|
||||||
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new GenericFastJsonRedisSerializer()));
|
// 使用 FastJSON 序列化缓存值,支持复杂对象
|
||||||
|
.serializeValuesWith(RedisSerializationContext.SerializationPair
|
||||||
|
.fromSerializer(new GenericFastJsonRedisSerializer()));
|
||||||
|
|
||||||
|
// 返回自定义缓存管理器,支持 cacheName#ttl 格式与永久缓存(#-1)
|
||||||
|
return new CustomRedisCacheManager(redisCacheWriter, defaultCacheConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = REDIS_CACHE)
|
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = REDIS_CACHE)
|
||||||
public CacheService redisCacheService() {
|
public CacheService redisCacheService() {
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class FileConfig implements WebMvcConfigurer {
|
|||||||
StaticCredentialsProvider.create(
|
StaticCredentialsProvider.create(
|
||||||
AwsBasicCredentials.create(accessKey, secretKey)))
|
AwsBasicCredentials.create(accessKey, secretKey)))
|
||||||
.serviceConfiguration(S3Configuration.builder()
|
.serviceConfiguration(S3Configuration.builder()
|
||||||
.pathStyleAccessEnabled(true)
|
.pathStyleAccessEnabled(false)
|
||||||
.chunkedEncodingEnabled(false)
|
.chunkedEncodingEnabled(false)
|
||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.lab1024.sa.base.config;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||||
@@ -13,6 +14,8 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.BigInteger;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeParseException;
|
import java.time.format.DateTimeParseException;
|
||||||
@@ -37,6 +40,9 @@ public class JsonConfig {
|
|||||||
builder.serializers(new LocalDateSerializer(DatePattern.NORM_DATE_FORMAT.getDateTimeFormatter()));
|
builder.serializers(new LocalDateSerializer(DatePattern.NORM_DATE_FORMAT.getDateTimeFormatter()));
|
||||||
builder.serializers(new LocalDateTimeSerializer(DatePattern.NORM_DATETIME_FORMAT.getDateTimeFormatter()));
|
builder.serializers(new LocalDateTimeSerializer(DatePattern.NORM_DATETIME_FORMAT.getDateTimeFormatter()));
|
||||||
builder.serializerByType(Long.class, LongJsonSerializer.INSTANCE);
|
builder.serializerByType(Long.class, LongJsonSerializer.INSTANCE);
|
||||||
|
builder.serializerByType(Long.TYPE, LongJsonSerializer.INSTANCE);
|
||||||
|
builder.serializerByType(BigInteger.class, ToStringSerializer.instance);
|
||||||
|
builder.serializerByType(BigDecimal.class, ToStringSerializer.instance);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.lab1024.sa.base.module.support.cache;
|
|||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import net.lab1024.sa.base.config.CacheConfig;
|
||||||
import net.lab1024.sa.base.constant.ReloadConst;
|
import net.lab1024.sa.base.constant.ReloadConst;
|
||||||
import net.lab1024.sa.base.module.support.reload.core.annoation.SmartReload;
|
import net.lab1024.sa.base.module.support.reload.core.annoation.SmartReload;
|
||||||
import org.springframework.data.redis.cache.RedisCache;
|
import org.springframework.data.redis.cache.RedisCache;
|
||||||
@@ -49,7 +50,7 @@ public class RedisCacheServiceImpl implements CacheService {
|
|||||||
// 获取 Redis 连接
|
// 获取 Redis 连接
|
||||||
RedisConnection connection = redisConnectionFactory.getConnection();
|
RedisConnection connection = redisConnectionFactory.getConnection();
|
||||||
// 根据指定的 key 模式获取所有匹配的键
|
// 根据指定的 key 模式获取所有匹配的键
|
||||||
Set<byte[]> keys = connection.keyCommands().keys((cacheName + ":*").getBytes());
|
Set<byte[]> keys = connection.keyCommands().keys((CacheConfig.REDIS_CACHE_PREFIX + ":" + cacheName + "*").getBytes());
|
||||||
|
|
||||||
if (keys != null) {
|
if (keys != null) {
|
||||||
return keys.stream().map(key -> {
|
return keys.stream().map(key -> {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class DictDataVO implements Serializable {
|
|||||||
private String dictName;
|
private String dictName;
|
||||||
|
|
||||||
@Schema(description = "字典禁用状态")
|
@Schema(description = "字典禁用状态")
|
||||||
private Integer dictDisabledFlag;
|
private Boolean dictDisabledFlag;
|
||||||
|
|
||||||
@Schema(description = "字典项值")
|
@Schema(description = "字典项值")
|
||||||
private String dataValue;
|
private String dataValue;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class DictVO {
|
|||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
@Schema(description = "禁用状态")
|
@Schema(description = "禁用状态")
|
||||||
private Integer disabledFlag;
|
private Boolean disabledFlag;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ public class FileStorageLocalServiceImpl implements IFileStorageService {
|
|||||||
// 目录不存在,新建
|
// 目录不存在,新建
|
||||||
directory.mkdirs();
|
directory.mkdirs();
|
||||||
}
|
}
|
||||||
if (!path.endsWith("/")) {
|
if (!path.endsWith(File.separator)) {
|
||||||
path = path + "/";
|
path = path + File.separator;
|
||||||
}
|
}
|
||||||
FileUploadVO fileUploadVO = new FileUploadVO();
|
FileUploadVO fileUploadVO = new FileUploadVO();
|
||||||
//原文件名
|
//原文件名
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ package net.lab1024.sa.base.module.support.loginlog.domain;
|
|||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@@ -20,6 +22,8 @@ import java.time.LocalDateTime;
|
|||||||
@TableName("t_login_log")
|
@TableName("t_login_log")
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class LoginLogEntity {
|
public class LoginLogEntity {
|
||||||
|
|
||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
|
|||||||
@@ -0,0 +1,145 @@
|
|||||||
|
package net.lab1024.sa.base.module.support.redis;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.boot.convert.DurationStyle;
|
||||||
|
import org.springframework.data.redis.cache.*;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
|
||||||
|
import static net.lab1024.sa.base.common.constant.StringConst.COLON;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义 RedisCacheManager,支持在 cacheName 中通过 '#' 指定 TTL(过期时间)。
|
||||||
|
*
|
||||||
|
* @Author CoderKK
|
||||||
|
* @Date 2025-08-15 13:01:01
|
||||||
|
* <p>
|
||||||
|
* 支持格式:{@code cacheName#ttl},其中 ttl 支持 Spring 的 Duration 格式。
|
||||||
|
* 特殊值:{@code -1} 表示永久缓存(永不过期)。
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <h3>使用示例:</h3>
|
||||||
|
* <pre>
|
||||||
|
* // 10 秒后过期
|
||||||
|
* @Cacheable(value = "user#10s", key = "#id")
|
||||||
|
* // 2 小时后过期
|
||||||
|
* @Cacheable(value = "report#2h", key = "#date")
|
||||||
|
* // 30 分钟后过期
|
||||||
|
* @Cacheable(value = "session#30m", key = "#token")
|
||||||
|
* // 永不过期(永久缓存),适用于极少变化的配置数据
|
||||||
|
* @Cacheable(value = "appConfig#-1", key = "'globalSettings'")
|
||||||
|
* // 无 TTL,使用全局默认过期时间(如 7 天)
|
||||||
|
* @Cacheable(value = "product", key = "#productId")
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <h3>生成的 Redis Key 格式:</h3>
|
||||||
|
* <pre>
|
||||||
|
* cache:cacheName:key
|
||||||
|
* 例如:cache:user:123
|
||||||
|
* cache:appConfig:globalSettings
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <h3>支持的 TTL 单位:</h3>
|
||||||
|
* <ul>
|
||||||
|
* <li>{@code ms} / {@code millis} / {@code milliseconds} - 毫秒</li>
|
||||||
|
* <li>{@code s} / {@code secs} / {@code seconds} - 秒</li>
|
||||||
|
* <li>{@code m} / {@code mins} / {@code minutes} - 分钟</li>
|
||||||
|
* <li>{@code h} / {@code hrs} / {@code hours} - 小时</li>
|
||||||
|
* <li>{@code d} / {@code days} - 天</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* <h3>注意事项:</h3>
|
||||||
|
* <ul>
|
||||||
|
* <li>不写单位默认为毫秒</li>
|
||||||
|
* <li>永久缓存(#-1)不会自动过期,请配合 @CacheEvict 手动清理。</li>
|
||||||
|
* <li>避免对频繁更新的数据使用永久缓存,防止数据陈旧。</li>
|
||||||
|
* <li>cacheName 中的 '#' 只解析第一个,后续字符将作为 TTL 处理。</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class CustomRedisCacheManager extends RedisCacheManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存全局前缀
|
||||||
|
*/
|
||||||
|
private static final String CACHE_PREFIX = "cache";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义 TTL 分隔符,用于在 cacheName 后附加过期时间
|
||||||
|
*/
|
||||||
|
private static final String CUSTOM_TTL_SEPARATOR = "#";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认缓存过期时间:7 天
|
||||||
|
*/
|
||||||
|
private static final Duration DEFAULT_TTL = Duration.ofDays(7);
|
||||||
|
|
||||||
|
public CustomRedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration) {
|
||||||
|
super(cacheWriter, defaultCacheConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建 RedisCache 实例,支持从 cacheName 解析 TTL
|
||||||
|
*
|
||||||
|
* @param name 缓存名称(支持 name#ttl 格式)
|
||||||
|
* @param cacheConfig 默认缓存配置
|
||||||
|
* @return RedisCache
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected RedisCache createRedisCache(String name, RedisCacheConfiguration cacheConfig) {
|
||||||
|
Duration ttl = parseTtlFromCacheName(name);
|
||||||
|
if (ttl == null) {
|
||||||
|
ttl = DEFAULT_TTL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CacheKeyPrefix keyPrefix = cacheName -> {
|
||||||
|
if (StrUtil.isBlank(cacheName)) {
|
||||||
|
return CACHE_PREFIX + COLON;
|
||||||
|
}
|
||||||
|
String[] parts = cacheName.split(CUSTOM_TTL_SEPARATOR, 2);
|
||||||
|
String cleanName = StrUtil.trim(parts[0]);
|
||||||
|
return CACHE_PREFIX + COLON + cleanName + COLON;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 构建最终缓存配置:设置 key 前缀 + TTL
|
||||||
|
RedisCacheConfiguration config = cacheConfig.computePrefixWith(keyPrefix).entryTtl(ttl);
|
||||||
|
|
||||||
|
return super.createRedisCache(name, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从 cacheName 中解析 TTL
|
||||||
|
*
|
||||||
|
* @param name 缓存名称,格式如:users#10m, products#2h, config#-1(永久)
|
||||||
|
* @return 解析出的 Duration若无效则返回 null;若为 -1,则返回 Duration.ofMillis(-1) 表示永久缓存
|
||||||
|
*/
|
||||||
|
private Duration parseTtlFromCacheName(String name) {
|
||||||
|
if (StrUtil.isBlank(name)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] parts = name.split(CUSTOM_TTL_SEPARATOR, 2);
|
||||||
|
if (parts.length < 2) {
|
||||||
|
return null; // 无 TTL 部分
|
||||||
|
}
|
||||||
|
|
||||||
|
String ttlStr = StrUtil.trim(parts[1]);
|
||||||
|
if (StrUtil.isBlank(ttlStr)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 特殊处理:-1 表示永久缓存
|
||||||
|
if ("-1".equals(ttlStr)) {
|
||||||
|
return Duration.ofMillis(-1); // Spring Redis 中负数 Duration 表示永不过期
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Duration ttl = DurationStyle.detectAndParse(ttlStr);
|
||||||
|
return ttl.getSeconds() > 0 ? ttl : null;
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
log.error("解析缓存 TTL 失败,cacheName='{}', ttl='{}', 错误: {}", name, ttlStr, e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,8 +3,10 @@ package net.lab1024.sa.base.module.support.securityprotect.domain;
|
|||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@@ -21,6 +23,8 @@ import java.time.LocalDateTime;
|
|||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
@TableName("t_login_fail")
|
@TableName("t_login_fail")
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class LoginFailEntity {
|
public class LoginFailEntity {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
"axios": "1.6.8",
|
"axios": "1.6.8",
|
||||||
"clipboard": "2.0.11",
|
"clipboard": "2.0.11",
|
||||||
"crypto-js": "4.1.1",
|
"crypto-js": "4.1.1",
|
||||||
"dayjs": "1.10.5",
|
"dayjs": "1.11.13",
|
||||||
"decimal.js": "10.3.1",
|
"decimal.js": "10.3.1",
|
||||||
"diff": "5.2.0",
|
"diff": "5.2.0",
|
||||||
"diff2html": "3.4.47",
|
"diff2html": "3.4.47",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||||
*/
|
*/
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
import { smartSentry } from '/@/lib/smart-sentry.js';
|
||||||
|
|
||||||
export const useSpinStore = defineStore({
|
export const useSpinStore = defineStore({
|
||||||
id: 'spin',
|
id: 'spin',
|
||||||
@@ -18,13 +19,27 @@ export const useSpinStore = defineStore({
|
|||||||
actions: {
|
actions: {
|
||||||
hide() {
|
hide() {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
let spins = document.querySelector('.ant-spin-nested-loading');
|
// 安全的DOM操作,避免null引用错误
|
||||||
spins.style.zIndex = 999;
|
try {
|
||||||
|
const spins = document.querySelector('.ant-spin-nested-loading');
|
||||||
|
if (spins) {
|
||||||
|
spins.style.zIndex = '999';
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
smartSentry.captureError('Spin hide操作失败:', error);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
show() {
|
show() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
let spins = document.querySelector('.ant-spin-nested-loading');
|
// 安全的DOM操作,避免null引用错误
|
||||||
spins.style.zIndex = 1001;
|
try {
|
||||||
|
const spins = document.querySelector('.ant-spin-nested-loading');
|
||||||
|
if (spins) {
|
||||||
|
spins.style.zIndex = '1001';
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
smartSentry.captureError('Spin hide操作失败:', error);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<a-form-item label="创建时间" class="smart-query-form-item">
|
<a-form-item label="创建时间" class="smart-query-form-item">
|
||||||
<a-space direction="vertical" :size="12">
|
<a-space direction="vertical" :size="12">
|
||||||
<a-range-picker v-model:value="searchDate" @change="dateChange" />
|
<a-range-picker v-model:value="searchDate" :presets="defaultTimeRanges" @change="dateChange" />
|
||||||
</a-space>
|
</a-space>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
@@ -93,6 +93,7 @@
|
|||||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||||
import { message, Modal } from 'ant-design-vue';
|
import { message, Modal } from 'ant-design-vue';
|
||||||
import { smartSentry } from '/@/lib/smart-sentry';
|
import { smartSentry } from '/@/lib/smart-sentry';
|
||||||
|
import { defaultTimeRanges } from '/@/lib/default-time-ranges';
|
||||||
import TableOperator from '/@/components/support/table-operator/index.vue';
|
import TableOperator from '/@/components/support/table-operator/index.vue';
|
||||||
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
|
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<a-form-item label="创建时间" class="smart-query-form-item">
|
<a-form-item label="创建时间" class="smart-query-form-item">
|
||||||
<a-space direction="vertical" :size="12">
|
<a-space direction="vertical" :size="12">
|
||||||
<a-range-picker v-model:value="searchDate" @change="dateChange" />
|
<a-range-picker v-model:value="searchDate" :presets="defaultTimeRanges" @change="dateChange" />
|
||||||
</a-space>
|
</a-space>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
@@ -92,6 +92,7 @@
|
|||||||
import { smartSentry } from '/@/lib/smart-sentry';
|
import { smartSentry } from '/@/lib/smart-sentry';
|
||||||
import TableOperator from '/@/components/support/table-operator/index.vue';
|
import TableOperator from '/@/components/support/table-operator/index.vue';
|
||||||
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
|
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
|
||||||
|
import { defaultTimeRanges } from '/@/lib/default-time-ranges.js';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
enterpriseId: {
|
enterpriseId: {
|
||||||
|
|||||||
@@ -3,23 +3,35 @@ import { convertUpperCamel } from '/@/utils/str-util';
|
|||||||
// -------------------------------- java 类型 --------------------------------
|
// -------------------------------- java 类型 --------------------------------
|
||||||
export const JavaTypeMap = new Map();
|
export const JavaTypeMap = new Map();
|
||||||
JavaTypeMap.set('bit', 'Boolean');
|
JavaTypeMap.set('bit', 'Boolean');
|
||||||
|
JavaTypeMap.set('bool', 'Boolean');
|
||||||
JavaTypeMap.set('int', 'Integer');
|
JavaTypeMap.set('int', 'Integer');
|
||||||
|
JavaTypeMap.set('int2', 'Integer');
|
||||||
|
JavaTypeMap.set('int4', 'Integer');
|
||||||
JavaTypeMap.set('tinyint', 'Integer');
|
JavaTypeMap.set('tinyint', 'Integer');
|
||||||
JavaTypeMap.set('smallint', 'Integer');
|
JavaTypeMap.set('smallint', 'Integer');
|
||||||
JavaTypeMap.set('integer', 'Integer');
|
JavaTypeMap.set('integer', 'Integer');
|
||||||
JavaTypeMap.set('year', 'Integer');
|
JavaTypeMap.set('year', 'Integer');
|
||||||
JavaTypeMap.set('bigint', 'Long');
|
JavaTypeMap.set('bigint', 'Long');
|
||||||
|
JavaTypeMap.set('int8', 'Long');
|
||||||
|
JavaTypeMap.set('number', 'Long');
|
||||||
JavaTypeMap.set('float', 'BigDecimal');
|
JavaTypeMap.set('float', 'BigDecimal');
|
||||||
JavaTypeMap.set('double', 'BigDecimal');
|
JavaTypeMap.set('double', 'BigDecimal');
|
||||||
JavaTypeMap.set('decimal', 'BigDecimal');
|
JavaTypeMap.set('decimal', 'BigDecimal');
|
||||||
JavaTypeMap.set('char', 'String');
|
JavaTypeMap.set('char', 'String');
|
||||||
JavaTypeMap.set('varchar', 'String');
|
JavaTypeMap.set('varchar', 'String');
|
||||||
|
JavaTypeMap.set('varchar2', 'String');
|
||||||
|
JavaTypeMap.set('nvarchar', 'String');
|
||||||
|
JavaTypeMap.set('nvarchar2', 'String');
|
||||||
JavaTypeMap.set('tinytext', 'String');
|
JavaTypeMap.set('tinytext', 'String');
|
||||||
JavaTypeMap.set('text', 'String');
|
JavaTypeMap.set('text', 'String');
|
||||||
JavaTypeMap.set('longtext', 'String');
|
JavaTypeMap.set('longtext', 'String');
|
||||||
JavaTypeMap.set('blob', 'String');
|
JavaTypeMap.set('blob', 'String');
|
||||||
|
JavaTypeMap.set('clob', 'String');
|
||||||
JavaTypeMap.set('date', 'LocalDate');
|
JavaTypeMap.set('date', 'LocalDate');
|
||||||
JavaTypeMap.set('datetime', 'LocalDateTime');
|
JavaTypeMap.set('datetime', 'LocalDateTime');
|
||||||
|
JavaTypeMap.set('datetime2', 'LocalDateTime');
|
||||||
|
JavaTypeMap.set('timestamp', 'LocalDateTime');
|
||||||
|
JavaTypeMap.set('timestamp without time zone', 'LocalDateTime');
|
||||||
|
|
||||||
export const JavaTypeList = [
|
export const JavaTypeList = [
|
||||||
'Boolean', //
|
'Boolean', //
|
||||||
@@ -39,7 +51,12 @@ export function getJavaType(dataType) {
|
|||||||
// -------------------------------- js 类型 --------------------------------
|
// -------------------------------- js 类型 --------------------------------
|
||||||
export const JsTypeMap = new Map();
|
export const JsTypeMap = new Map();
|
||||||
JsTypeMap.set('bit', 'Boolean');
|
JsTypeMap.set('bit', 'Boolean');
|
||||||
|
JsTypeMap.set('bool', 'Boolean');
|
||||||
JsTypeMap.set('int', 'Number');
|
JsTypeMap.set('int', 'Number');
|
||||||
|
JsTypeMap.set('int2', 'Number');
|
||||||
|
JsTypeMap.set('int4', 'Number');
|
||||||
|
JsTypeMap.set('int8', 'Number');
|
||||||
|
JsTypeMap.set('number', 'Number');
|
||||||
JsTypeMap.set('tinyint', 'Number');
|
JsTypeMap.set('tinyint', 'Number');
|
||||||
JsTypeMap.set('smallint', 'Number');
|
JsTypeMap.set('smallint', 'Number');
|
||||||
JsTypeMap.set('integer', 'Number');
|
JsTypeMap.set('integer', 'Number');
|
||||||
@@ -50,12 +67,20 @@ JsTypeMap.set('double', 'Number');
|
|||||||
JsTypeMap.set('decimal', 'Number');
|
JsTypeMap.set('decimal', 'Number');
|
||||||
JsTypeMap.set('char', 'String');
|
JsTypeMap.set('char', 'String');
|
||||||
JsTypeMap.set('varchar', 'String');
|
JsTypeMap.set('varchar', 'String');
|
||||||
|
JsTypeMap.set('varchar2', 'String');
|
||||||
|
JsTypeMap.set('nvarchar', 'String');
|
||||||
|
JsTypeMap.set('nvarchar2', 'String');
|
||||||
|
JsTypeMap.set('character', 'String');
|
||||||
JsTypeMap.set('tinytext', 'String');
|
JsTypeMap.set('tinytext', 'String');
|
||||||
JsTypeMap.set('text', 'String');
|
JsTypeMap.set('text', 'String');
|
||||||
JsTypeMap.set('longtext', 'String');
|
JsTypeMap.set('longtext', 'String');
|
||||||
JsTypeMap.set('blob', 'String');
|
JsTypeMap.set('blob', 'String');
|
||||||
|
JsTypeMap.set('clob', 'String');
|
||||||
JsTypeMap.set('date', 'Date');
|
JsTypeMap.set('date', 'Date');
|
||||||
JsTypeMap.set('datetime', 'Date');
|
JsTypeMap.set('datetime', 'Date');
|
||||||
|
JsTypeMap.set('datetime2', 'Date');
|
||||||
|
JsTypeMap.set('timestamp', 'Date');
|
||||||
|
JsTypeMap.set('timestamp without time zone', 'Date');
|
||||||
|
|
||||||
export const JsTypeList = [
|
export const JsTypeList = [
|
||||||
'Boolean', //
|
'Boolean', //
|
||||||
@@ -72,23 +97,36 @@ export function getJsType(dataType) {
|
|||||||
|
|
||||||
export const FrontComponentMap = new Map();
|
export const FrontComponentMap = new Map();
|
||||||
FrontComponentMap.set('bit', 'BooleanSelect');
|
FrontComponentMap.set('bit', 'BooleanSelect');
|
||||||
|
FrontComponentMap.set('bool', 'BooleanSelect');
|
||||||
FrontComponentMap.set('int', 'InputNumber');
|
FrontComponentMap.set('int', 'InputNumber');
|
||||||
|
FrontComponentMap.set('int2', 'InputNumber');
|
||||||
|
FrontComponentMap.set('int4', 'InputNumber');
|
||||||
|
FrontComponentMap.set('int8', 'InputNumber');
|
||||||
|
FrontComponentMap.set('number', 'InputNumber');
|
||||||
FrontComponentMap.set('tinyint', 'InputNumber');
|
FrontComponentMap.set('tinyint', 'InputNumber');
|
||||||
FrontComponentMap.set('smallint', 'InputNumber');
|
FrontComponentMap.set('smallint', 'InputNumber');
|
||||||
FrontComponentMap.set('integer', 'InputNumber');
|
FrontComponentMap.set('integer', 'InputNumber');
|
||||||
FrontComponentMap.set('year', 'Date');
|
FrontComponentMap.set('year', 'Date');
|
||||||
|
FrontComponentMap.set('timestamp', 'Date');
|
||||||
FrontComponentMap.set('bigint', 'InputNumber');
|
FrontComponentMap.set('bigint', 'InputNumber');
|
||||||
FrontComponentMap.set('float', 'InputNumber');
|
FrontComponentMap.set('float', 'InputNumber');
|
||||||
FrontComponentMap.set('double', 'InputNumber');
|
FrontComponentMap.set('double', 'InputNumber');
|
||||||
FrontComponentMap.set('decimal', 'InputNumber');
|
FrontComponentMap.set('decimal', 'InputNumber');
|
||||||
FrontComponentMap.set('char', 'Input');
|
FrontComponentMap.set('char', 'Input');
|
||||||
FrontComponentMap.set('varchar', 'Input');
|
FrontComponentMap.set('varchar', 'Input');
|
||||||
|
FrontComponentMap.set('varchar2', 'Input');
|
||||||
|
FrontComponentMap.set('nvarchar', 'Input');
|
||||||
|
FrontComponentMap.set('nvarchar2', 'Input');
|
||||||
|
FrontComponentMap.set('character', 'Input');
|
||||||
FrontComponentMap.set('tinytext', 'Input');
|
FrontComponentMap.set('tinytext', 'Input');
|
||||||
FrontComponentMap.set('text', 'Textarea');
|
FrontComponentMap.set('text', 'Textarea');
|
||||||
FrontComponentMap.set('longtext', 'Textarea');
|
FrontComponentMap.set('longtext', 'Textarea');
|
||||||
FrontComponentMap.set('blob', 'FileUpload');
|
FrontComponentMap.set('blob', 'FileUpload');
|
||||||
|
FrontComponentMap.set('clob', 'FileUpload');
|
||||||
FrontComponentMap.set('date', 'Date');
|
FrontComponentMap.set('date', 'Date');
|
||||||
FrontComponentMap.set('datetime', 'DateTime');
|
FrontComponentMap.set('datetime', 'DateTime');
|
||||||
|
FrontComponentMap.set('datetime2', 'DateTime');
|
||||||
|
FrontComponentMap.set('timestamp without time zone', 'DateTime');
|
||||||
|
|
||||||
export function getFrontComponent(dataType) {
|
export function getFrontComponent(dataType) {
|
||||||
return FrontComponentMap.get(dataType);
|
return FrontComponentMap.get(dataType);
|
||||||
|
|||||||
@@ -102,6 +102,7 @@
|
|||||||
const visibleFlag = ref(false);
|
const visibleFlag = ref(false);
|
||||||
function showModal(table) {
|
function showModal(table) {
|
||||||
Object.assign(tableInfo, table);
|
Object.assign(tableInfo, table);
|
||||||
|
tableInfo.tableName = tableInfo.tableName.toLowerCase();
|
||||||
tableInfo.createTime = table.createTime ? table.createTime : new Date();
|
tableInfo.createTime = table.createTime ? table.createTime : new Date();
|
||||||
activeKey.value = '1';
|
activeKey.value = '1';
|
||||||
visibleFlag.value = true;
|
visibleFlag.value = true;
|
||||||
|
|||||||
@@ -168,9 +168,9 @@
|
|||||||
let keywordsFilterFlag = true;
|
let keywordsFilterFlag = true;
|
||||||
if (keywords.value) {
|
if (keywords.value) {
|
||||||
keywordsFilterFlag =
|
keywordsFilterFlag =
|
||||||
_.includes(item.dataValue.toLowerCase(), keywords.value.toLowerCase()) ||
|
(item.dataValue &&_.includes(item.dataValue.toLowerCase(), keywords.value.toLowerCase())) ||
|
||||||
_.includes(item.dataLabel.toLowerCase(), keywords.value.toLowerCase()) ||
|
(item.dataLabel && _.includes(item.dataLabel.toLowerCase(), keywords.value.toLowerCase())) ||
|
||||||
_.includes(item.remark.toLowerCase(), keywords.value.toLowerCase());
|
(item.remark && _.includes(item.remark.toLowerCase(), keywords.value.toLowerCase()));
|
||||||
}
|
}
|
||||||
let disabledFilterFlag = _.isNull(disabledFlag.value) ? true : item.disabledFlag === disabledFlag.value;
|
let disabledFilterFlag = _.isNull(disabledFlag.value) ? true : item.disabledFlag === disabledFlag.value;
|
||||||
return disabledFilterFlag && keywordsFilterFlag;
|
return disabledFilterFlag && keywordsFilterFlag;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* @Date: 2024/06/25
|
* @Date: 2024/06/25
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<a-drawer v-model:open="showFlag" :width="1000" :title="title" placement="right" :destroyOnClose="true">
|
<a-drawer v-model:open="showFlag" :width="1100" :title="title" placement="right" :destroyOnClose="true">
|
||||||
<a-form class="smart-query-form">
|
<a-form class="smart-query-form">
|
||||||
<a-row class="smart-query-form-row">
|
<a-row class="smart-query-form-row">
|
||||||
<a-form-item label="关键字" class="smart-query-form-item">
|
<a-form-item label="关键字" class="smart-query-form-item">
|
||||||
@@ -12,13 +12,13 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="执行结果" class="smart-query-form-item">
|
<a-form-item label="执行结果" class="smart-query-form-item">
|
||||||
<a-select style="width: 100px" v-model:value="queryForm.successFlag" placeholder="请选择" allowClear>
|
<a-select style="width: 100px" v-model:value="queryForm.successFlag" placeholder="请选择" allowClear>
|
||||||
<a-select-option :key="1"> 成功 </a-select-option>
|
<a-select-option :key="1"> 成功</a-select-option>
|
||||||
<a-select-option :key="0"> 失败 </a-select-option>
|
<a-select-option :key="0"> 失败</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="执行时间" class="smart-query-form-item">
|
<a-form-item label="执行时间" class="smart-query-form-item">
|
||||||
<a-space direction="vertical" :size="12">
|
<a-space direction="vertical" :size="12">
|
||||||
<a-range-picker v-model:value="searchDate" style="width: 220px" @change="dateChange" />
|
<a-range-picker v-model:value="searchDate" style="width: 220px" :presets="defaultTimeRanges" @change="dateChange" />
|
||||||
</a-space>
|
</a-space>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
@@ -41,7 +41,6 @@
|
|||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
|
||||||
<a-card size="small" :bordered="false" :hoverable="true">
|
|
||||||
<a-row justify="end">
|
<a-row justify="end">
|
||||||
<TableOperator class="smart-margin-bottom5" v-model="columns" :tableId="TABLE_ID_CONST.SUPPORT.JOB_LOG" :refresh="queryLogList" />
|
<TableOperator class="smart-margin-bottom5" v-model="columns" :tableId="TABLE_ID_CONST.SUPPORT.JOB_LOG" :refresh="queryLogList" />
|
||||||
</a-row>
|
</a-row>
|
||||||
@@ -49,13 +48,25 @@
|
|||||||
<a-table size="small" :loading="tableLoading" bordered :dataSource="tableData" :columns="columns" rowKey="jobLogId" :pagination="false">
|
<a-table size="small" :loading="tableLoading" bordered :dataSource="tableData" :columns="columns" rowKey="jobLogId" :pagination="false">
|
||||||
<template #bodyCell="{ record, column }">
|
<template #bodyCell="{ record, column }">
|
||||||
<template v-if="column.dataIndex === 'executeStartTime'">
|
<template v-if="column.dataIndex === 'executeStartTime'">
|
||||||
<div><a-tag color="green">始</a-tag>{{ record.executeStartTime }}</div>
|
<div>
|
||||||
<div style="margin-top: 5px"><a-tag color="blue">终</a-tag>{{ record.executeEndTime }}</div>
|
<a-tag color="green">始</a-tag>
|
||||||
|
{{ record.executeStartTime }}
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 5px">
|
||||||
|
<a-tag color="blue">终</a-tag>
|
||||||
|
{{ record.executeEndTime }}
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.dataIndex === 'executeTimeMillis'"> {{ record.executeTimeMillis }} ms </template>
|
<template v-if="column.dataIndex === 'executeTimeMillis'"> {{ record.executeTimeMillis }} ms</template>
|
||||||
<template v-if="column.dataIndex === 'successFlag'">
|
<template v-if="column.dataIndex === 'successFlag'">
|
||||||
<div v-if="record.successFlag" style="color: #39c710"><CheckOutlined />成功</div>
|
<div v-if="record.successFlag" style="color: #39c710">
|
||||||
<div v-else style="color: #f50"><WarningOutlined />失败</div>
|
<CheckOutlined />
|
||||||
|
成功
|
||||||
|
</div>
|
||||||
|
<div v-else style="color: #f50">
|
||||||
|
<WarningOutlined />
|
||||||
|
失败
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
@@ -74,7 +85,6 @@
|
|||||||
:show-total="(total) => `共${total}条`"
|
:show-total="(total) => `共${total}条`"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</a-card>
|
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
@@ -84,6 +94,7 @@
|
|||||||
import { smartSentry } from '/@/lib/smart-sentry';
|
import { smartSentry } from '/@/lib/smart-sentry';
|
||||||
import TableOperator from '/@/components/support/table-operator/index.vue';
|
import TableOperator from '/@/components/support/table-operator/index.vue';
|
||||||
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
|
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
|
||||||
|
import { defaultTimeRanges } from '/@/lib/default-time-ranges.js';
|
||||||
|
|
||||||
const showFlag = ref(false);
|
const showFlag = ref(false);
|
||||||
const title = ref('');
|
const title = ref('');
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<SmartEnumSelect width="120px" enum-name="FLAG_NUMBER_ENUM" v-model:value="queryForm.readFlag" />
|
<SmartEnumSelect width="120px" enum-name="FLAG_NUMBER_ENUM" v-model:value="queryForm.readFlag" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="创建时间" class="smart-query-form-item">
|
<a-form-item label="创建时间" class="smart-query-form-item">
|
||||||
<a-range-picker v-model:value="queryForm.createTime" style="width: 200px" @change="onChangeCreateTime" />
|
<a-range-picker v-model:value="queryForm.createTime" :presets="defaultTimeRanges" style="width: 200px" @change="onChangeCreateTime" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item class="smart-query-form-item">
|
<a-form-item class="smart-query-form-item">
|
||||||
<a-button type="primary" @click="searchQuery">
|
<a-button type="primary" @click="searchQuery">
|
||||||
@@ -96,6 +96,7 @@
|
|||||||
import TableOperator from '/@/components/support/table-operator/index.vue';
|
import TableOperator from '/@/components/support/table-operator/index.vue';
|
||||||
import MessageSendForm from './components/message-send-form.vue';
|
import MessageSendForm from './components/message-send-form.vue';
|
||||||
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
|
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
|
||||||
|
import { defaultTimeRanges } from '/@/lib/default-time-ranges.js';
|
||||||
// ---------------------------- 表格列 ----------------------------
|
// ---------------------------- 表格列 ----------------------------
|
||||||
|
|
||||||
const columns = ref([
|
const columns = ref([
|
||||||
|
|||||||
@@ -234,12 +234,21 @@
|
|||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.center-container {
|
.center-container {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
.header-title {
|
.header-title {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.center-form-area {
|
.center-form-area {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
min-height: 0;
|
||||||
|
|
||||||
|
|
||||||
.avatar-container {
|
.avatar-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@@ -8,9 +8,10 @@
|
|||||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<a-modal :open="visible" width="600px" :bodyStyle="{height:'360px'}" title="" :closable="false" :maskClosable="true">
|
<a-modal :open="visible" width="600px" :bodyStyle="{height:'400px'}" title="" :closable="false" :maskClosable="true">
|
||||||
<a-row><div style="font-weight:bolder;margin: 0 auto;font-size: 16px;color: red;">重磅更新:国产数据库支持🎉🎉</div> </a-row>
|
<a-row><div style="font-weight:bolder;margin: 0 auto;font-size: 16px;color: red;">重磅更新:国产数据库支持🎉🎉</div> </a-row>
|
||||||
<a-row><div style="font-weight:bolder;margin: 10px auto;font-size: 16px;color: red;">支持:达梦、人大金仓、华为高斯GaussDB 等🎉🎉</div> </a-row>
|
<a-row><div style="font-weight:bolder;margin: 10px auto;font-size: 16px;color: red;">国产数据库:达梦、人大金仓、华为高斯GaussDB 等🎉🎉</div> </a-row>
|
||||||
|
<a-row><div style="font-weight:bolder;margin: 0 auto;font-size: 16px;color: red;">主流数据库:Mysql、PostgreSQL 等🎉🎉</div> </a-row>
|
||||||
<br />
|
<br />
|
||||||
<div class="app-qr-box">
|
<div class="app-qr-box">
|
||||||
<div class="app-qr">
|
<div class="app-qr">
|
||||||
|
|||||||
@@ -52,11 +52,11 @@
|
|||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<OfficialAccountCard />
|
<OfficialAccountCard />
|
||||||
</a-col>
|
</a-col>
|
||||||
<!--待办、已办-->
|
<!--更新日志-->
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<ChangelogCard />
|
<ChangelogCard />
|
||||||
</a-col>
|
</a-col>
|
||||||
<!--更新日志-->
|
<!--待办、已办-->
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<ToBeDoneCard />
|
<ToBeDoneCard />
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
"axios": "1.6.8",
|
"axios": "1.6.8",
|
||||||
"clipboard": "2.0.11",
|
"clipboard": "2.0.11",
|
||||||
"crypto-js": "4.1.1",
|
"crypto-js": "4.1.1",
|
||||||
"dayjs": "1.10.5",
|
"dayjs": "1.11.13",
|
||||||
"decimal.js": "10.3.1",
|
"decimal.js": "10.3.1",
|
||||||
"default-passive-events": "^2.0.0",
|
"default-passive-events": "^2.0.0",
|
||||||
"diff": "5.2.0",
|
"diff": "5.2.0",
|
||||||
|
|||||||
@@ -3,23 +3,35 @@ import { convertUpperCamel } from '/@/utils/str-util';
|
|||||||
// -------------------------------- java 类型 --------------------------------
|
// -------------------------------- java 类型 --------------------------------
|
||||||
export const JavaTypeMap = new Map();
|
export const JavaTypeMap = new Map();
|
||||||
JavaTypeMap.set('bit', 'Boolean');
|
JavaTypeMap.set('bit', 'Boolean');
|
||||||
|
JavaTypeMap.set('bool', 'Boolean');
|
||||||
JavaTypeMap.set('int', 'Integer');
|
JavaTypeMap.set('int', 'Integer');
|
||||||
|
JavaTypeMap.set('int2', 'Integer');
|
||||||
|
JavaTypeMap.set('int4', 'Integer');
|
||||||
JavaTypeMap.set('tinyint', 'Integer');
|
JavaTypeMap.set('tinyint', 'Integer');
|
||||||
JavaTypeMap.set('smallint', 'Integer');
|
JavaTypeMap.set('smallint', 'Integer');
|
||||||
JavaTypeMap.set('integer', 'Integer');
|
JavaTypeMap.set('integer', 'Integer');
|
||||||
JavaTypeMap.set('year', 'Integer');
|
JavaTypeMap.set('year', 'Integer');
|
||||||
JavaTypeMap.set('bigint', 'Long');
|
JavaTypeMap.set('bigint', 'Long');
|
||||||
|
JavaTypeMap.set('int8', 'Long');
|
||||||
|
JavaTypeMap.set('number', 'Long');
|
||||||
JavaTypeMap.set('float', 'BigDecimal');
|
JavaTypeMap.set('float', 'BigDecimal');
|
||||||
JavaTypeMap.set('double', 'BigDecimal');
|
JavaTypeMap.set('double', 'BigDecimal');
|
||||||
JavaTypeMap.set('decimal', 'BigDecimal');
|
JavaTypeMap.set('decimal', 'BigDecimal');
|
||||||
JavaTypeMap.set('char', 'String');
|
JavaTypeMap.set('char', 'String');
|
||||||
JavaTypeMap.set('varchar', 'String');
|
JavaTypeMap.set('varchar', 'String');
|
||||||
|
JavaTypeMap.set('varchar2', 'String');
|
||||||
|
JavaTypeMap.set('nvarchar', 'String');
|
||||||
|
JavaTypeMap.set('nvarchar2', 'String');
|
||||||
JavaTypeMap.set('tinytext', 'String');
|
JavaTypeMap.set('tinytext', 'String');
|
||||||
JavaTypeMap.set('text', 'String');
|
JavaTypeMap.set('text', 'String');
|
||||||
JavaTypeMap.set('longtext', 'String');
|
JavaTypeMap.set('longtext', 'String');
|
||||||
JavaTypeMap.set('blob', 'String');
|
JavaTypeMap.set('blob', 'String');
|
||||||
|
JavaTypeMap.set('clob', 'String');
|
||||||
JavaTypeMap.set('date', 'LocalDate');
|
JavaTypeMap.set('date', 'LocalDate');
|
||||||
JavaTypeMap.set('datetime', 'LocalDateTime');
|
JavaTypeMap.set('datetime', 'LocalDateTime');
|
||||||
|
JavaTypeMap.set('datetime2', 'LocalDateTime');
|
||||||
|
JavaTypeMap.set('timestamp', 'LocalDateTime');
|
||||||
|
JavaTypeMap.set('timestamp without time zone', 'LocalDateTime');
|
||||||
|
|
||||||
export const JavaTypeList = [
|
export const JavaTypeList = [
|
||||||
'Boolean', //
|
'Boolean', //
|
||||||
@@ -39,7 +51,12 @@ export function getJavaType(dataType) {
|
|||||||
// -------------------------------- js 类型 --------------------------------
|
// -------------------------------- js 类型 --------------------------------
|
||||||
export const JsTypeMap = new Map();
|
export const JsTypeMap = new Map();
|
||||||
JsTypeMap.set('bit', 'Boolean');
|
JsTypeMap.set('bit', 'Boolean');
|
||||||
|
JsTypeMap.set('bool', 'Boolean');
|
||||||
JsTypeMap.set('int', 'Number');
|
JsTypeMap.set('int', 'Number');
|
||||||
|
JsTypeMap.set('int2', 'Number');
|
||||||
|
JsTypeMap.set('int4', 'Number');
|
||||||
|
JsTypeMap.set('int8', 'Number');
|
||||||
|
JsTypeMap.set('number', 'Number');
|
||||||
JsTypeMap.set('tinyint', 'Number');
|
JsTypeMap.set('tinyint', 'Number');
|
||||||
JsTypeMap.set('smallint', 'Number');
|
JsTypeMap.set('smallint', 'Number');
|
||||||
JsTypeMap.set('integer', 'Number');
|
JsTypeMap.set('integer', 'Number');
|
||||||
@@ -50,12 +67,20 @@ JsTypeMap.set('double', 'Number');
|
|||||||
JsTypeMap.set('decimal', 'Number');
|
JsTypeMap.set('decimal', 'Number');
|
||||||
JsTypeMap.set('char', 'String');
|
JsTypeMap.set('char', 'String');
|
||||||
JsTypeMap.set('varchar', 'String');
|
JsTypeMap.set('varchar', 'String');
|
||||||
|
JsTypeMap.set('varchar2', 'String');
|
||||||
|
JsTypeMap.set('nvarchar', 'String');
|
||||||
|
JsTypeMap.set('nvarchar2', 'String');
|
||||||
|
JsTypeMap.set('character', 'String');
|
||||||
JsTypeMap.set('tinytext', 'String');
|
JsTypeMap.set('tinytext', 'String');
|
||||||
JsTypeMap.set('text', 'String');
|
JsTypeMap.set('text', 'String');
|
||||||
JsTypeMap.set('longtext', 'String');
|
JsTypeMap.set('longtext', 'String');
|
||||||
JsTypeMap.set('blob', 'String');
|
JsTypeMap.set('blob', 'String');
|
||||||
|
JsTypeMap.set('clob', 'String');
|
||||||
JsTypeMap.set('date', 'Date');
|
JsTypeMap.set('date', 'Date');
|
||||||
JsTypeMap.set('datetime', 'Date');
|
JsTypeMap.set('datetime', 'Date');
|
||||||
|
JsTypeMap.set('datetime2', 'Date');
|
||||||
|
JsTypeMap.set('timestamp', 'Date');
|
||||||
|
JsTypeMap.set('timestamp without time zone', 'Date');
|
||||||
|
|
||||||
export const JsTypeList = [
|
export const JsTypeList = [
|
||||||
'Boolean', //
|
'Boolean', //
|
||||||
@@ -72,23 +97,36 @@ export function getJsType(dataType) {
|
|||||||
|
|
||||||
export const FrontComponentMap = new Map();
|
export const FrontComponentMap = new Map();
|
||||||
FrontComponentMap.set('bit', 'BooleanSelect');
|
FrontComponentMap.set('bit', 'BooleanSelect');
|
||||||
|
FrontComponentMap.set('bool', 'BooleanSelect');
|
||||||
FrontComponentMap.set('int', 'InputNumber');
|
FrontComponentMap.set('int', 'InputNumber');
|
||||||
|
FrontComponentMap.set('int2', 'InputNumber');
|
||||||
|
FrontComponentMap.set('int4', 'InputNumber');
|
||||||
|
FrontComponentMap.set('int8', 'InputNumber');
|
||||||
|
FrontComponentMap.set('number', 'InputNumber');
|
||||||
FrontComponentMap.set('tinyint', 'InputNumber');
|
FrontComponentMap.set('tinyint', 'InputNumber');
|
||||||
FrontComponentMap.set('smallint', 'InputNumber');
|
FrontComponentMap.set('smallint', 'InputNumber');
|
||||||
FrontComponentMap.set('integer', 'InputNumber');
|
FrontComponentMap.set('integer', 'InputNumber');
|
||||||
FrontComponentMap.set('year', 'Date');
|
FrontComponentMap.set('year', 'Date');
|
||||||
|
FrontComponentMap.set('timestamp', 'Date');
|
||||||
FrontComponentMap.set('bigint', 'InputNumber');
|
FrontComponentMap.set('bigint', 'InputNumber');
|
||||||
FrontComponentMap.set('float', 'InputNumber');
|
FrontComponentMap.set('float', 'InputNumber');
|
||||||
FrontComponentMap.set('double', 'InputNumber');
|
FrontComponentMap.set('double', 'InputNumber');
|
||||||
FrontComponentMap.set('decimal', 'InputNumber');
|
FrontComponentMap.set('decimal', 'InputNumber');
|
||||||
FrontComponentMap.set('char', 'Input');
|
FrontComponentMap.set('char', 'Input');
|
||||||
FrontComponentMap.set('varchar', 'Input');
|
FrontComponentMap.set('varchar', 'Input');
|
||||||
|
FrontComponentMap.set('varchar2', 'Input');
|
||||||
|
FrontComponentMap.set('nvarchar', 'Input');
|
||||||
|
FrontComponentMap.set('nvarchar2', 'Input');
|
||||||
|
FrontComponentMap.set('character', 'Input');
|
||||||
FrontComponentMap.set('tinytext', 'Input');
|
FrontComponentMap.set('tinytext', 'Input');
|
||||||
FrontComponentMap.set('text', 'Textarea');
|
FrontComponentMap.set('text', 'Textarea');
|
||||||
FrontComponentMap.set('longtext', 'Textarea');
|
FrontComponentMap.set('longtext', 'Textarea');
|
||||||
FrontComponentMap.set('blob', 'FileUpload');
|
FrontComponentMap.set('blob', 'FileUpload');
|
||||||
|
FrontComponentMap.set('clob', 'FileUpload');
|
||||||
FrontComponentMap.set('date', 'Date');
|
FrontComponentMap.set('date', 'Date');
|
||||||
FrontComponentMap.set('datetime', 'DateTime');
|
FrontComponentMap.set('datetime', 'DateTime');
|
||||||
|
FrontComponentMap.set('datetime2', 'DateTime');
|
||||||
|
FrontComponentMap.set('timestamp without time zone', 'DateTime');
|
||||||
|
|
||||||
export function getFrontComponent(dataType) {
|
export function getFrontComponent(dataType) {
|
||||||
return FrontComponentMap.get(dataType);
|
return FrontComponentMap.get(dataType);
|
||||||
|
|||||||
@@ -102,6 +102,7 @@
|
|||||||
const visibleFlag = ref(false);
|
const visibleFlag = ref(false);
|
||||||
function showModal(table) {
|
function showModal(table) {
|
||||||
Object.assign(tableInfo, table);
|
Object.assign(tableInfo, table);
|
||||||
|
tableInfo.tableName = tableInfo.tableName.toLowerCase();
|
||||||
tableInfo.createTime = table.createTime ? table.createTime : new Date();
|
tableInfo.createTime = table.createTime ? table.createTime : new Date();
|
||||||
activeKey.value = '1';
|
activeKey.value = '1';
|
||||||
visibleFlag.value = true;
|
visibleFlag.value = true;
|
||||||
|
|||||||
@@ -168,9 +168,9 @@
|
|||||||
let keywordsFilterFlag = true;
|
let keywordsFilterFlag = true;
|
||||||
if (keywords.value) {
|
if (keywords.value) {
|
||||||
keywordsFilterFlag =
|
keywordsFilterFlag =
|
||||||
_.includes(item.dataValue.toLowerCase(), keywords.value.toLowerCase()) ||
|
(item.dataValue &&_.includes(item.dataValue.toLowerCase(), keywords.value.toLowerCase())) ||
|
||||||
_.includes(item.dataLabel.toLowerCase(), keywords.value.toLowerCase()) ||
|
(item.dataLabel && _.includes(item.dataLabel.toLowerCase(), keywords.value.toLowerCase())) ||
|
||||||
_.includes(item.remark.toLowerCase(), keywords.value.toLowerCase());
|
(item.remark && _.includes(item.remark.toLowerCase(), keywords.value.toLowerCase()));
|
||||||
}
|
}
|
||||||
let disabledFilterFlag = _.isNull(disabledFlag.value) ? true : item.disabledFlag === disabledFlag.value;
|
let disabledFilterFlag = _.isNull(disabledFlag.value) ? true : item.disabledFlag === disabledFlag.value;
|
||||||
return disabledFilterFlag && keywordsFilterFlag;
|
return disabledFilterFlag && keywordsFilterFlag;
|
||||||
|
|||||||
16
数据库SQL脚本/README.md
Normal file
16
数据库SQL脚本/README.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
|
||||||
|
序号| 数据库 | 类型 | 免费 | 支持 | 下载
|
||||||
|
-------- |------------------------------------------------------------------|--------------------| ----- |-------------------------| ----
|
||||||
|
1| [Mysql](https://www.mysql.com) | 国外🌈 | 免费🍉 | Java8+Java17 ✔️ | [Gitee](https://gitee.com/lab1024/smart-admin/tree/master/%E6%95%B0%E6%8D%AE%E5%BA%93SQL%E8%84%9A%E6%9C%AC/mysql)
|
||||||
|
2| [PostgreSQL](https://www.postgresql.org/) | 国外🌈 | 收费🎉️ | Java8+Java17 ✔️ | [购买](../buy.md)
|
||||||
|
3| [SqlServer](https://www.microsoft.com/en-us/sql-server/) | 国外🌈 | 收费🎉️ | Java8+Java17 ✔️ | [购买](../buy.md)
|
||||||
|
4| [Oracle](https://www.oracle.com/) | 国外🌈 | 收费🎉️ | Java8+Java17 ✔️ | [购买](../buy.md)
|
||||||
|
5| [达梦 DM8](https://www.dameng.com/DM8.html) | 国产🔥 | 收费🎉️ | Java8+Java17 ✔️ | [购买](../buy.md)
|
||||||
|
6| [电科(人大)金仓 KingBaseES](https://www.kingbase.com.cn) | 国产🔥 | 收费🎉️ | Java8+Java17 ✔️ | [购买](../buy.md)
|
||||||
|
7| [华为高斯 GaussDB](https://www.huaweicloud.com/product/gaussdb.html) | 国产🔥 | 收费🎉️ | Java8+Java17 ✔️ | [购买](../buy.md)
|
||||||
|
8| [OpenGaussDB](https://opengauss.org/zh/) | 国产🔥 | 收费🎉️ | Java8+Java17 ✔️ | [购买](../buy.md)
|
||||||
|
9| [神通 ShenTong](http://www.shentongdata.com.cn/) | 国产🔥 | 收费🎉️ | Java8+Java17 ✔️ | [购买](../buy.md)
|
||||||
|
10| [海量 VastData](https://www.vastdata.com.cn) | 国产🔥 | 收费🎉️ | Java8+Java17 ✔️ | [购买](../buy.md)
|
||||||
|
11| [海扬 OceanBase](https://www.oceanbase.com/) | 国产🔥 | 收费🎉️ | Java8+Java17 ✔️ | [购买](../buy.md)
|
||||||
|
12| [阿里云 PolarDB](https://www.polardbx.com/) | 国产🔥 | 收费🎉️ | Java8+Java17 ✔️ | [购买](../buy.md)
|
||||||
@@ -924,7 +924,7 @@ CREATE TABLE `t_operate_log` (
|
|||||||
`url` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '请求路径',
|
`url` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '请求路径',
|
||||||
`method` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '请求方法',
|
`method` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '请求方法',
|
||||||
`param` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '请求参数',
|
`param` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '请求参数',
|
||||||
`response` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求参数',
|
`response` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '返回值',
|
||||||
`ip` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求ip',
|
`ip` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求ip',
|
||||||
`ip_region` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求ip地区',
|
`ip_region` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求ip地区',
|
||||||
`user_agent` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '请求user-agent',
|
`user_agent` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '请求user-agent',
|
||||||
Reference in New Issue
Block a user