mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2026-01-26 00:26:21 +08:00
v3.29 【优化】优化代码生成;【优化】优化redis缓存key;【优化】员工禁用强制下线bug;【优化】本地文件使用File.separator
This commit is contained in:
@@ -36,7 +36,6 @@ public class DepartmentEntity {
|
||||
/**
|
||||
* 负责人员工 id
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.NEVER)
|
||||
private Long managerId;
|
||||
|
||||
/**
|
||||
|
||||
@@ -274,12 +274,12 @@ public class EmployeeService {
|
||||
if (null == employeeEntity) {
|
||||
return ResponseDTO.error(UserErrorCode.DATA_NOT_EXIST);
|
||||
}
|
||||
|
||||
// 更新禁用状态
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
SELECT * FROM t_goods
|
||||
<where>
|
||||
<if test="query.searchWord != null and query.searchWord !=''">
|
||||
INSTR(goods_name,#{query.searchWord})
|
||||
AND INSTR(goods_name,#{query.searchWord})
|
||||
</if>
|
||||
<if test="query.place != null">
|
||||
AND INSTR(place,#{query.place})
|
||||
|
||||
@@ -23,8 +23,11 @@ import org.springframework.data.redis.serializer.RedisSerializationContext;
|
||||
public class CacheConfig {
|
||||
|
||||
private static final String REDIS_CACHE = "redis";
|
||||
|
||||
private static final String CAFFEINE_CACHE = "caffeine";
|
||||
|
||||
public static final String REDIS_CACHE_PREFIX = "cache";
|
||||
|
||||
|
||||
@Resource
|
||||
private RedisConnectionFactory redisConnectionFactory;
|
||||
@@ -45,7 +48,7 @@ public class CacheConfig {
|
||||
RedisCacheConfiguration defaultCacheConfig = RedisCacheConfiguration.defaultCacheConfig()
|
||||
// 禁止缓存 null 值,避免缓存穿透
|
||||
.disableCachingNullValues()
|
||||
.computePrefixWith(name -> "cache:" + name + ":")
|
||||
.computePrefixWith(name -> REDIS_CACHE_PREFIX + name + ":")
|
||||
// 使用 FastJSON 序列化缓存值,支持复杂对象
|
||||
.serializeValuesWith(RedisSerializationContext.SerializationPair
|
||||
.fromSerializer(new GenericFastJsonRedisSerializer()));
|
||||
|
||||
@@ -81,7 +81,7 @@ public class FileConfig implements WebMvcConfigurer {
|
||||
StaticCredentialsProvider.create(
|
||||
AwsBasicCredentials.create(accessKey, secretKey)))
|
||||
.serviceConfiguration(S3Configuration.builder()
|
||||
.pathStyleAccessEnabled(true)
|
||||
.pathStyleAccessEnabled(false)
|
||||
.chunkedEncodingEnabled(false)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.lab1024.sa.base.module.support.cache;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import jakarta.annotation.Resource;
|
||||
import net.lab1024.sa.base.config.CacheConfig;
|
||||
import net.lab1024.sa.base.constant.ReloadConst;
|
||||
import net.lab1024.sa.base.module.support.reload.core.annoation.SmartReload;
|
||||
import org.springframework.data.redis.cache.RedisCache;
|
||||
@@ -49,7 +50,7 @@ public class RedisCacheServiceImpl implements CacheService {
|
||||
// 获取 Redis 连接
|
||||
RedisConnection connection = redisConnectionFactory.getConnection();
|
||||
// 根据指定的 key 模式获取所有匹配的键
|
||||
Set<byte[]> keys = connection.keyCommands().keys((cacheName + ":*").getBytes());
|
||||
Set<byte[]> keys = connection.keyCommands().keys((CacheConfig.REDIS_CACHE_PREFIX + ":" + cacheName + "*").getBytes());
|
||||
|
||||
if (keys != null) {
|
||||
return keys.stream().map(key -> {
|
||||
|
||||
@@ -78,8 +78,8 @@ public class FileStorageLocalServiceImpl implements IFileStorageService {
|
||||
// 目录不存在,新建
|
||||
directory.mkdirs();
|
||||
}
|
||||
if (!path.endsWith("/")) {
|
||||
path = path + "/";
|
||||
if (!path.endsWith(File.separator)) {
|
||||
path = path + File.separator;
|
||||
}
|
||||
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.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -20,6 +22,8 @@ import java.time.LocalDateTime;
|
||||
@TableName("t_login_log")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LoginLogEntity {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@@ -3,8 +3,10 @@ package net.lab1024.sa.base.module.support.securityprotect.domain;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -21,6 +23,8 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
@Builder
|
||||
@TableName("t_login_fail")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LoginFailEntity {
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user