use of com.dimple.project.system.domain.Config in project DimpleBlog by martin-chips.
the class ConfigServiceImpl method selectConfigById.
@Override
public Config selectConfigById(Long configId) {
Config config = new Config();
config.setId(configId);
return configMapper.selectConfig(config);
}
use of com.dimple.project.system.domain.Config in project DimpleBlog by martin-chips.
the class ConfigServiceImpl method selectConfigByConfigKey.
@Override
@Cacheable(value = CacheConstants.CACHE_NAME_BACKEND_CONFIG, key = "#key")
@CacheExpire(expire = 5, type = TimeType.HOURS)
public <T> T selectConfigByConfigKey(String key, Class<T> tClass) {
Config config = new Config();
config.setConfigKey(key);
Config retConfig = configMapper.selectConfig(config);
if (retConfig == null) {
throw new CustomException("Can not get config by key " + key);
}
return JSON.parseObject(retConfig.getConfigValue(), tClass);
}
use of com.dimple.project.system.domain.Config in project DimpleBlog by martin-chips.
the class ConfigServiceImpl method selectConfigByKey.
@Override
public Config selectConfigByKey(String configKey) {
Config config = new Config();
config.setConfigKey(configKey);
Config retConfig = configMapper.selectConfig(config);
return Objects.isNull(retConfig) ? new Config() : retConfig;
}
use of com.dimple.project.system.domain.Config in project DimpleBlog by martin-chips.
the class SettingController method editEmailSetting.
@PutMapping("emailSetting")
@Log(title = "系统设置-邮件设置", businessType = BusinessType.UPDATE)
@PreAuthorize("@permissionService.hasPermission('system:setting:emailSetting:edit')")
public AjaxResult editEmailSetting(@RequestBody EmailSetting emailSetting) {
String jsonString = JSON.toJSONString(emailSetting);
Config config = new Config();
config.setConfigKey(ConfigKey.CONFIG_KEY_EMAIL_SETTING);
config.setConfigValue(jsonString);
return AjaxResult.success(configService.updateConfigByConfigKey(config));
}
use of com.dimple.project.system.domain.Config in project DimpleBlog by martin-chips.
the class SettingController method editAbout.
@PutMapping("/about")
@Log(title = "系统设置-关于", businessType = BusinessType.UPDATE)
@PreAuthorize("@permissionService.hasPermission('system:setting:about:edit')")
public AjaxResult editAbout(@RequestBody AboutSetting aboutSetting) {
String jsonString = JSON.toJSONString(aboutSetting);
Config config = new Config();
config.setConfigKey(ConfigKey.CONFIG_KEY_ABOUT);
config.setConfigValue(jsonString);
return AjaxResult.success(configService.updateConfigByConfigKey(config));
}
Aggregations