perf: 基础设置功能健壮性提升
将基础功能设置枚举类增加多个描述字段
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
package com.adc.da.sys.constant;
|
package com.adc.da.sys.constant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ThinkBook
|
* @author CaiHaohan
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public enum TsConfigKeyEnum {
|
public enum TsConfigKeyEnum {
|
||||||
@@ -9,5 +9,29 @@ public enum TsConfigKeyEnum {
|
|||||||
/**
|
/**
|
||||||
* 水印前缀
|
* 水印前缀
|
||||||
*/
|
*/
|
||||||
WATERMARK_PREFIX
|
WATERMARK_PREFIX("WATERMARK_PREFIX", "水印前缀");
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对应Key
|
||||||
|
*/
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代表意义
|
||||||
|
*/
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
TsConfigKeyEnum(String value, String label) {
|
||||||
|
this.value = value;
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class ConfigServiceImpl extends ServiceImpl<ConfigDao, ConfigEntity>
|
|||||||
public List<ConfigVo> findAllConfig() {
|
public List<ConfigVo> findAllConfig() {
|
||||||
List<ConfigVo> result = new ArrayList<>();
|
List<ConfigVo> result = new ArrayList<>();
|
||||||
for (TsConfigKeyEnum configKey : TsConfigKeyEnum.values()) {
|
for (TsConfigKeyEnum configKey : TsConfigKeyEnum.values()) {
|
||||||
List<ConfigEntity> configEntityList = query().eq("config_key", configKey.toString()).list();
|
List<ConfigEntity> configEntityList = query().eq("config_key", configKey.getValue()).list();
|
||||||
if (!configEntityList.isEmpty()){
|
if (!configEntityList.isEmpty()){
|
||||||
ConfigVo configVo = new ConfigVo();
|
ConfigVo configVo = new ConfigVo();
|
||||||
BeanUtil.copyProperties(configEntityList.get(0), configVo);
|
BeanUtil.copyProperties(configEntityList.get(0), configVo);
|
||||||
@@ -84,14 +84,12 @@ public class ConfigServiceImpl extends ServiceImpl<ConfigDao, ConfigEntity>
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean isKeyValid(String key) {
|
private boolean isKeyValid(String key) {
|
||||||
boolean isValid = false;
|
|
||||||
|
|
||||||
for (TsConfigKeyEnum configKey : TsConfigKeyEnum.values()) {
|
for (TsConfigKeyEnum configKey : TsConfigKeyEnum.values()) {
|
||||||
if (configKey.toString().equals(key)) {
|
if (configKey.getValue().equals(key)) {
|
||||||
isValid = true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return isValid;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user