增加修改配置方法
This commit is contained in:
parent
0d708e2c8b
commit
b628f96bdb
@ -26,6 +26,14 @@ public interface IConfigService extends ISystemConfigCheckService {
|
|||||||
*/
|
*/
|
||||||
void updateConfig(ConfigVO configVO) throws Exception;
|
void updateConfig(ConfigVO configVO) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新配置
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
|
void updateConfig(String key, Object value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询配置
|
* 查询配置
|
||||||
*
|
*
|
||||||
|
@ -8,6 +8,7 @@ import ink.wgink.login.base.pojo.dtos.config.ConfigDTO;
|
|||||||
import ink.wgink.login.base.pojo.vos.ConfigVO;
|
import ink.wgink.login.base.pojo.vos.ConfigVO;
|
||||||
import ink.wgink.login.base.service.config.IConfigService;
|
import ink.wgink.login.base.service.config.IConfigService;
|
||||||
import ink.wgink.util.map.HashMapUtil;
|
import ink.wgink.util.map.HashMapUtil;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -49,6 +50,26 @@ public class ConfigServiceImpl extends DefaultBaseService implements IConfigServ
|
|||||||
ConfigManager.getInstance().refreshConfig();
|
ConfigManager.getInstance().refreshConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateConfig(String key, Object value) {
|
||||||
|
if (StringUtils.isBlank(key)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (value == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<String, Object> configParams = new HashMap<>(2);
|
||||||
|
configParams.put(ConfigManager.CONFIG_KEY, key);
|
||||||
|
configParams.put(ConfigManager.CONFIG_VALUE, value);
|
||||||
|
ConfigDTO configDTO = configDao.get(key);
|
||||||
|
if (configDTO == null) {
|
||||||
|
configDao.save(configParams);
|
||||||
|
} else {
|
||||||
|
configDao.update(configParams);
|
||||||
|
}
|
||||||
|
ConfigManager.getInstance().refreshConfig();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getConfig() {
|
public Map<String, Object> getConfig() {
|
||||||
List<ConfigDTO> configDTOs = configDao.list();
|
List<ConfigDTO> configDTOs = configDao.list();
|
||||||
|
Loading…
Reference in New Issue
Block a user