fix 系统参数使用到MySQL8保留字

This commit is contained in:
DaxPay
2024-10-28 11:47:58 +08:00
parent 4ba1d7e5db
commit 51cbcd6223
5 changed files with 9 additions and 9 deletions

View File

@@ -30,21 +30,21 @@ public class SystemParamManager extends BaseManager<SystemParamMapper, SystemPar
* 根据键名获取键值
*/
public Optional<SystemParameter> findByKey(String key) {
return this.findByField(SystemParameter::getKey, key);
return this.findByField(SystemParameter::getParamKey, key);
}
/**
* key重复检查
*/
public boolean existsByKey(String key) {
return existedByField(SystemParameter::getKey, key);
return existedByField(SystemParameter::getParamKey, key);
}
/**
* key重复检查
*/
public boolean existsByKey(String key, Long id) {
return existedByField(SystemParameter::getKey, key, id);
return existedByField(SystemParameter::getParamKey, key, id);
}
/**
@@ -54,7 +54,7 @@ public class SystemParamManager extends BaseManager<SystemParamMapper, SystemPar
Page<SystemParameter> mpPage = MpUtil.getMpPage(pageParam);
return lambdaQuery().orderByDesc(MpIdEntity::getId)
.like(StrUtil.isNotBlank(param.getName()), SystemParameter::getName, param.getName())
.like(StrUtil.isNotBlank(param.getKey()), SystemParameter::getKey, param.getKey())
.like(StrUtil.isNotBlank(param.getParamKey()), SystemParameter::getParamKey, param.getParamKey())
.page(mpPage);
}

View File

@@ -28,7 +28,7 @@ public class SystemParameter extends MpBaseEntity implements ToResult<SystemPara
private String name;
/** 参数键名 */
private String key;
private String paramKey;
/** 参数值 */
private String value;

View File

@@ -31,7 +31,7 @@ public class SystemParameterParam {
@NotEmpty(message = "参数键名不可为空", groups = ValidationGroup.add.class)
@Schema(description = "参数键名")
private String key;
private String paramKey;
@NotEmpty(message = "参数值不可为空", groups = ValidationGroup.add.class)
@Schema(description = "参数值")

View File

@@ -24,7 +24,7 @@ public class SystemParameterResult {
private String name;
@Schema(description = "参数键名")
private String key;
private String getParamKey;
@Schema(description = "参数值")
private String value;

View File

@@ -36,7 +36,7 @@ public class SystemParamService {
*/
public void add(SystemParameterParam param) {
SystemParameter systemParameter = SystemParameter.init(param);
if (systemParamManager.existsByKey(systemParameter.getKey())) {
if (systemParamManager.existsByKey(systemParameter.getParamKey())) {
throw new BizException("key重复");
}
// 默认非内置
@@ -52,7 +52,7 @@ public class SystemParamService {
SystemParameter systemParameter = systemParamManager.findById(param.getId())
.orElseThrow(() -> new BizException("参数项不存在"));
if (systemParamManager.existsByKey(param.getKey(), param.getId())) {
if (systemParamManager.existsByKey(param.getParamKey(), param.getId())) {
throw new BizException("key重复");
}
BeanUtil.copyProperties(param, systemParameter, CopyOptions.create().ignoreNullValue());