参数管理,支持布尔类型
This commit is contained in:
parent
2f67811474
commit
d2fab3b212
|
@ -38,6 +38,13 @@ public interface SysParamsService extends BaseService<SysParamsEntity> {
|
|||
int getInt(String paramKey);
|
||||
|
||||
/**
|
||||
* 根据paramKey,获取布尔值
|
||||
*
|
||||
* @param paramKey 参数Key
|
||||
*/
|
||||
boolean getBoolean(String paramKey);
|
||||
|
||||
/**
|
||||
* 根据paramKey,获取对象值
|
||||
*
|
||||
* @param paramKey 参数Key
|
||||
|
|
|
@ -114,7 +114,12 @@ public class SysParamsServiceImpl extends BaseServiceImpl<SysParamsDao, SysParam
|
|||
|
||||
@Override
|
||||
public String getString(String paramKey) {
|
||||
return sysParamsCache.get(paramKey);
|
||||
String value = sysParamsCache.get(paramKey);
|
||||
if (StrUtil.isBlank(value)) {
|
||||
throw new ServerException("参数不能为空,paramKey:" + paramKey);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -125,6 +130,13 @@ public class SysParamsServiceImpl extends BaseServiceImpl<SysParamsDao, SysParam
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(String paramKey) {
|
||||
String value = getString(paramKey);
|
||||
|
||||
return Boolean.parseBoolean(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getJSONObject(String paramKey, Class<T> valueType) {
|
||||
String value = getString(paramKey);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user