mirror of
https://github.com/1024-lab/smart-admin.git
synced 2025-09-01 18:34:37 +00:00
v3.21.0 【新增】修改部门名称字段;【新增】修改系统版本version字段;【新增】优化代码生成前端代码;【优化】SQL
This commit is contained in:
@@ -35,7 +35,8 @@ public class CacheConfig {
|
||||
return RedisCacheConfiguration.defaultCacheConfig()
|
||||
.disableCachingNullValues()
|
||||
.computePrefixWith(name -> "cache:" + name + ":")
|
||||
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new GenericFastJsonRedisSerializer()));
|
||||
// .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new GenericFastJsonRedisSerializer()));
|
||||
;
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@@ -7,6 +7,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
|
||||
/**
|
||||
* mp 插件
|
||||
*
|
||||
|
@@ -28,7 +28,7 @@ public class ChangeLogEntity {
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
private String version;
|
||||
private String updateVersion;
|
||||
|
||||
/**
|
||||
* 更新类型:[1:特大版本功能更新;2:功能更新;3:bug修复]
|
||||
|
@@ -22,7 +22,7 @@ public class ChangeLogAddForm {
|
||||
|
||||
@Schema(description = "版本", required = true)
|
||||
@NotBlank(message = "版本 不能为空")
|
||||
private String version;
|
||||
private String updateVersion;
|
||||
|
||||
@SchemaEnum(value = ChangeLogTypeEnum.class, desc = "更新类型:[1:特大版本功能更新;2:功能更新;3:bug修复]")
|
||||
@CheckEnum(value = ChangeLogTypeEnum.class, message = "更新类型:[1:特大版本功能更新;2:功能更新;3:bug修复] 错误", required = true)
|
||||
|
@@ -26,7 +26,7 @@ public class ChangeLogUpdateForm {
|
||||
|
||||
@Schema(description = "版本", required = true)
|
||||
@NotBlank(message = "版本 不能为空")
|
||||
private String version;
|
||||
private String updateVersion;
|
||||
|
||||
@SchemaEnum(value = ChangeLogTypeEnum.class, desc = "更新类型:[1:特大版本功能更新;2:功能更新;3:bug修复]")
|
||||
@CheckEnum(value = ChangeLogTypeEnum.class, message = "更新类型:[1:特大版本功能更新;2:功能更新;3:bug修复] 错误", required = true)
|
||||
|
@@ -23,7 +23,7 @@ public class ChangeLogVO {
|
||||
private Long changeLogId;
|
||||
|
||||
@Schema(description = "版本")
|
||||
private String version;
|
||||
private String updateVersion;
|
||||
|
||||
@SchemaEnum(value = ChangeLogTypeEnum.class, desc = "更新类型:[1:特大版本功能更新;2:功能更新;3:bug修复]")
|
||||
private Integer type;
|
||||
|
@@ -44,7 +44,7 @@ public class ChangeLogService {
|
||||
* 添加
|
||||
*/
|
||||
public synchronized ResponseDTO<String> add(ChangeLogAddForm addForm) {
|
||||
ChangeLogEntity existVersion = changeLogDao.selectByVersion(addForm.getVersion());
|
||||
ChangeLogEntity existVersion = changeLogDao.selectByVersion(addForm.getUpdateVersion());
|
||||
if (existVersion != null) {
|
||||
return ResponseDTO.userErrorParam("此版本已经存在");
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class ChangeLogService {
|
||||
* 更新
|
||||
*/
|
||||
public synchronized ResponseDTO<String> update(ChangeLogUpdateForm updateForm) {
|
||||
ChangeLogEntity existVersion = changeLogDao.selectByVersion(updateForm.getVersion());
|
||||
ChangeLogEntity existVersion = changeLogDao.selectByVersion(updateForm.getUpdateVersion());
|
||||
if (existVersion != null && !updateForm.getChangeLogId().equals(existVersion.getChangeLogId())) {
|
||||
return ResponseDTO.userErrorParam("此版本已经存在");
|
||||
}
|
||||
|
@@ -11,16 +11,6 @@ package net.lab1024.sa.base.module.support.codegenerator.constant;
|
||||
*/
|
||||
public class CodeGeneratorConstant {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
public final static String PRIMARY_KEY = "PRI";
|
||||
|
||||
/**
|
||||
* 自增
|
||||
*/
|
||||
public final static String AUTO_INCREMENT = "auto_increment";
|
||||
|
||||
/**
|
||||
* 默认逻辑删除字段名称
|
||||
*/
|
||||
|
@@ -23,20 +23,26 @@ public class TableColumnVO {
|
||||
@Schema(description = "列描述")
|
||||
private String columnComment;
|
||||
|
||||
@Schema(description = "columnKey")
|
||||
private String columnKey;
|
||||
|
||||
@Schema(description = "extra")
|
||||
private String extra;
|
||||
|
||||
@Schema(description = "是否为空")
|
||||
private String isNullable;
|
||||
|
||||
@Schema(description = "数据类型varchar")
|
||||
private String dataType;
|
||||
|
||||
@Schema(description = "列类型varchar(50)")
|
||||
private String columnType;
|
||||
@Schema(description = "是否为空")
|
||||
private Boolean nullableFlag;
|
||||
|
||||
@Schema(description = "是否为主键")
|
||||
private Boolean primaryKeyFlag;
|
||||
|
||||
@Schema(description = "是否递增")
|
||||
private Boolean autoIncreaseFlag;
|
||||
|
||||
// --------------- 临时字段 -------------------
|
||||
|
||||
@Schema(hidden = true)
|
||||
private String columnKey;
|
||||
|
||||
@Schema(hidden = true)
|
||||
private String extra;
|
||||
|
||||
@Schema(hidden = true)
|
||||
private String isNullable;
|
||||
}
|
||||
|
@@ -128,6 +128,16 @@ public class DataTracerChangeContentService {
|
||||
return this.getAddDeleteContent(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析批量bean的内容
|
||||
*
|
||||
* @param objectList 对象列表
|
||||
* @return 单个内容
|
||||
*/
|
||||
public <T> String getChangeContent(List<T> objectList) {
|
||||
return this.getObjectListContent(objectList);
|
||||
}
|
||||
|
||||
// ---------------------------- 以下 是 私有private 方法 ----------------------------
|
||||
|
||||
/**
|
||||
@@ -160,6 +170,7 @@ public class DataTracerChangeContentService {
|
||||
return "【原数据】:<br/>" + oldContent + "<br/>" + "【新数据】:<br/>" + newContent;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取一个对象的内容信息
|
||||
*
|
||||
|
@@ -43,7 +43,6 @@ public class HelpDocCatalogEntity {
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@TableField("`sort`")
|
||||
private Integer sort;
|
||||
|
||||
|
||||
|
@@ -53,7 +53,6 @@ public class HelpDocEntity {
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@TableField("`sort`")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
|
@@ -47,7 +47,7 @@ import java.util.Map;
|
||||
@Component
|
||||
public class MailService {
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private JavaMailSender javaMailSender;
|
||||
|
||||
@Resource
|
||||
|
@@ -3,6 +3,7 @@ package net.lab1024.sa.base.module.support.securityprotect.service;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
import net.lab1024.sa.base.module.support.config.ConfigKeyEnum;
|
||||
@@ -29,17 +30,29 @@ public class Level3ProtectConfigService {
|
||||
|
||||
/**
|
||||
* 开启双因子登录,默认:开启
|
||||
* -- GETTER --
|
||||
* 开启双因子登录,默认:开启
|
||||
|
||||
*/
|
||||
@Getter
|
||||
private boolean twoFactorLoginEnabled = false;
|
||||
|
||||
/**
|
||||
* 连续登录失败次数则锁定,-1表示不受限制,可以一直尝试登录
|
||||
* -- GETTER --
|
||||
* 连续登录失败次数则锁定,-1表示不受限制,可以一直尝试登录
|
||||
|
||||
*/
|
||||
@Getter
|
||||
private int loginFailMaxTimes = -1;
|
||||
|
||||
/**
|
||||
* 连续登录失败锁定时间(单位:秒),-1表示不锁定,建议锁定30分钟
|
||||
* -- GETTER --
|
||||
* 连续登录失败锁定时间(单位:秒),-1表示不锁定,建议锁定30分钟
|
||||
|
||||
*/
|
||||
@Getter
|
||||
private int loginFailLockSeconds = 1800;
|
||||
|
||||
/**
|
||||
@@ -49,61 +62,53 @@ public class Level3ProtectConfigService {
|
||||
|
||||
/**
|
||||
* 密码复杂度 是否开启,默认:开启
|
||||
* -- GETTER --
|
||||
* 密码复杂度 是否开启,默认:开启
|
||||
|
||||
*/
|
||||
@Getter
|
||||
private boolean passwordComplexityEnabled = true;
|
||||
|
||||
/**
|
||||
* 定期修改密码时间间隔(默认:天),默认:建议90天更换密码
|
||||
* -- GETTER --
|
||||
* 定期修改密码时间间隔(默认:天),默认:建议90天更换密码
|
||||
|
||||
*/
|
||||
@Getter
|
||||
private int regularChangePasswordDays = 90;
|
||||
|
||||
/**
|
||||
* 定期修改密码不允许相同次数,默认:3次以内密码不能相同
|
||||
* -- GETTER --
|
||||
* 定期修改密码不允许相同次数,默认:3次以内密码不能相同
|
||||
|
||||
*/
|
||||
@Getter
|
||||
private int regularChangePasswordNotAllowRepeatTimes = 3;
|
||||
|
||||
/**
|
||||
* 文件大小限制,单位 mb ,(默认:50 mb)
|
||||
* -- GETTER --
|
||||
* 文件大小限制,单位 mb ,(默认:50 mb)
|
||||
|
||||
*/
|
||||
@Getter
|
||||
private long maxUploadFileSizeMb = 50;
|
||||
|
||||
/**
|
||||
* 文件检测,默认:不开启
|
||||
* -- GETTER --
|
||||
* 文件检测,默认:不开启
|
||||
|
||||
*/
|
||||
@Getter
|
||||
private boolean fileDetectFlag = false;
|
||||
|
||||
|
||||
@Resource
|
||||
private ConfigService configService;
|
||||
|
||||
/**
|
||||
* 文件检测,默认:不开启
|
||||
*/
|
||||
public boolean isFileDetectFlag() {
|
||||
return fileDetectFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件大小限制,单位 mb ,(默认:50 mb)
|
||||
*/
|
||||
public long getMaxUploadFileSizeMb() {
|
||||
return maxUploadFileSizeMb;
|
||||
}
|
||||
|
||||
/**
|
||||
* 连续登录失败次数则锁定,-1表示不受限制,可以一直尝试登录
|
||||
*/
|
||||
public int getLoginFailMaxTimes() {
|
||||
return loginFailMaxTimes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 连续登录失败锁定时间(单位:秒),-1表示不锁定,建议锁定30分钟
|
||||
*/
|
||||
public int getLoginFailLockSeconds() {
|
||||
return loginFailLockSeconds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 最低活跃时间(单位:秒),超过此时间没有操作系统就会被冻结,默认-1 代表不限制,永不冻结; 默认 30分钟
|
||||
*/
|
||||
@@ -111,34 +116,6 @@ public class Level3ProtectConfigService {
|
||||
return loginActiveTimeoutSeconds > 0 ? loginActiveTimeoutSeconds : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 定期修改密码时间间隔(默认:天),默认:建议90天更换密码
|
||||
*/
|
||||
public int getRegularChangePasswordDays() {
|
||||
return regularChangePasswordDays;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启双因子登录,默认:开启
|
||||
*/
|
||||
public boolean isTwoFactorLoginEnabled() {
|
||||
return twoFactorLoginEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* 密码复杂度 是否开启,默认:开启
|
||||
*/
|
||||
public boolean isPasswordComplexityEnabled() {
|
||||
return passwordComplexityEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* 定期修改密码不允许相同次数,默认:3次以内密码不能相同
|
||||
*/
|
||||
public int getRegularChangePasswordNotAllowRepeatTimes() {
|
||||
return regularChangePasswordNotAllowRepeatTimes;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
void init() {
|
||||
String configValue = configService.getConfigValue(ConfigKeyEnum.LEVEL3_PROTECT_CONFIG);
|
||||
|
@@ -9,6 +9,8 @@ import net.lab1024.sa.base.module.support.serialnumber.dao.SerialNumberDao;
|
||||
import net.lab1024.sa.base.module.support.serialnumber.dao.SerialNumberRecordDao;
|
||||
import net.lab1024.sa.base.module.support.serialnumber.domain.*;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
@@ -92,6 +94,7 @@ public abstract class SerialNumberBaseService implements SerialNumberService {
|
||||
public abstract void initLastGenerateData(List<SerialNumberEntity> serialNumberEntityList);
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public String generate(SerialNumberIdEnum serialNumberIdEnum) {
|
||||
List<String> generateList = this.generate(serialNumberIdEnum, 1);
|
||||
if (generateList == null || generateList.isEmpty()) {
|
||||
@@ -101,6 +104,7 @@ public abstract class SerialNumberBaseService implements SerialNumberService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public List<String> generate(SerialNumberIdEnum serialNumberIdEnum, int count) {
|
||||
SerialNumberInfoBO serialNumberInfoBO = serialNumberMap.get(serialNumberIdEnum.getSerialNumberId());
|
||||
if (serialNumberInfoBO == null) {
|
||||
|
@@ -9,7 +9,6 @@ import net.lab1024.sa.base.module.support.serialnumber.domain.SerialNumberGenera
|
||||
import net.lab1024.sa.base.module.support.serialnumber.domain.SerialNumberInfoBO;
|
||||
import net.lab1024.sa.base.module.support.serialnumber.domain.SerialNumberLastGenerateBO;
|
||||
import net.lab1024.sa.base.module.support.serialnumber.service.SerialNumberBaseService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
@@ -61,22 +60,24 @@ public class SerialNumberRedisService extends SerialNumberBaseService {
|
||||
public List<String> generateSerialNumberList(SerialNumberInfoBO serialNumberInfo, int count) {
|
||||
SerialNumberGenerateResultBO serialNumberGenerateResult = null;
|
||||
String lockKey = RedisKeyConst.Support.SERIAL_NUMBER + serialNumberInfo.getSerialNumberId();
|
||||
try {
|
||||
boolean lock = false;
|
||||
for (int i = 0; i < MAX_GET_LOCK_COUNT; i++) {
|
||||
try {
|
||||
lock = redisService.getLock(lockKey, 60 * 1000L);
|
||||
if (lock) {
|
||||
break;
|
||||
}
|
||||
Thread.sleep(SLEEP_MILLISECONDS);
|
||||
} catch (Throwable e) {
|
||||
log.error(e.getMessage(), e);
|
||||
|
||||
boolean lock = false;
|
||||
for (int i = 0; i < MAX_GET_LOCK_COUNT; i++) {
|
||||
try {
|
||||
lock = redisService.getLock(lockKey, 60 * 1000L);
|
||||
if (lock) {
|
||||
break;
|
||||
}
|
||||
Thread.sleep(SLEEP_MILLISECONDS);
|
||||
} catch (Throwable e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
if (!lock) {
|
||||
throw new BusinessException("SerialNumber 尝试5次,未能生成单号");
|
||||
}
|
||||
}
|
||||
if (!lock) {
|
||||
throw new BusinessException("SerialNumber 尝试5次,未能生成单号");
|
||||
}
|
||||
|
||||
try {
|
||||
// 获取上次的生成结果
|
||||
SerialNumberLastGenerateBO lastGenerateBO = (SerialNumberLastGenerateBO) redisService.mget(
|
||||
RedisKeyConst.Support.SERIAL_NUMBER_LAST_INFO,
|
||||
|
@@ -14,7 +14,7 @@
|
||||
</if>
|
||||
<!--关键字-->
|
||||
<if test="queryForm.keyword != null and queryForm.keyword != ''">
|
||||
AND ( INSTR(t_change_log.version,#{queryForm.keyword})
|
||||
AND ( INSTR(t_change_log.update_version,#{queryForm.keyword})
|
||||
OR INSTR(t_change_log.publish_author,#{queryForm.keyword})
|
||||
OR INSTR(t_change_log.content,#{queryForm.keyword})
|
||||
)
|
||||
@@ -35,12 +35,12 @@
|
||||
AND t_change_log.link = #{queryForm.link}
|
||||
</if>
|
||||
</where>
|
||||
order by t_change_log.version desc
|
||||
order by t_change_log.update_version desc
|
||||
</select>
|
||||
|
||||
<select id="selectByVersion"
|
||||
resultType="net.lab1024.sa.base.module.support.changelog.domain.entity.ChangeLogEntity">
|
||||
select * from t_change_log where `version` = #{version}
|
||||
select * from t_change_log where update_version = #{version}
|
||||
</select>
|
||||
|
||||
|
||||
|
@@ -13,7 +13,7 @@
|
||||
<if test="query.userType != null">
|
||||
AND user_type = #{query.userType}
|
||||
</if>
|
||||
<if test="query.ip != null">
|
||||
<if test="query.ip != null and query.ip != ''">
|
||||
AND INSTR(login_ip,#{query.ip})
|
||||
</if>
|
||||
<if test="query.startDate != null and query.startDate != ''">
|
||||
@@ -25,9 +25,6 @@
|
||||
<if test="query.userName != null and query.userName != ''">
|
||||
AND INSTR(user_name,#{query.userName})
|
||||
</if>
|
||||
<if test="query.ip != null">
|
||||
AND INSTR(login_ip,#{query.ip})
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
@@ -37,9 +34,9 @@
|
||||
*
|
||||
from t_login_log
|
||||
where
|
||||
user_id = #{userId}
|
||||
and user_type = #{userType}
|
||||
and login_result = #{loginLogResult}
|
||||
user_id = #{userId}
|
||||
and user_type = #{userType}
|
||||
and login_result = #{loginLogResult}
|
||||
order by login_log_id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
@@ -23,10 +23,10 @@
|
||||
AND INSTR(operate_user_name,#{query.userName})
|
||||
</if>
|
||||
<if test="query.keywords != null and query.keywords != ''">
|
||||
AND (INSTR(`module`,#{query.keywords}) OR INSTR(content,#{query.keywords}))
|
||||
AND (INSTR(module,#{query.keywords}) OR INSTR(content,#{query.keywords}))
|
||||
</if>
|
||||
<if test="query.requestKeywords != null and query.requestKeywords != ''">
|
||||
AND (INSTR(`url`,#{query.requestKeywords}) OR INSTR(`method`,#{query.requestKeywords}) OR INSTR(`param`,#{query.requestKeywords}))
|
||||
AND (INSTR(url,#{query.requestKeywords}) OR INSTR(method,#{query.requestKeywords}) OR INSTR(param,#{query.requestKeywords}))
|
||||
</if>
|
||||
<if test="query.successFlag != null">
|
||||
AND success_flag = #{query.successFlag}
|
||||
|
Reference in New Issue
Block a user