|
@@ -2,11 +2,12 @@ package com.warewms.system.service.impl;
|
|
|
|
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
-import java.util.Map;
|
|
|
|
import javax.annotation.PostConstruct;
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
-import com.warewms.common.service.impl.CrudServiceImpl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
+import com.warewms.common.core.domain.base.page.PageDomain;
|
|
|
|
+import com.warewms.common.core.domain.base.page.TableDataInfo;
|
|
|
|
+import com.warewms.common.service.impl.SystemService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import com.warewms.common.annotation.DataSource;
|
|
import com.warewms.common.annotation.DataSource;
|
|
@@ -27,7 +28,12 @@ import com.warewms.system.service.ISysConfigService;
|
|
* @author ruoyi
|
|
* @author ruoyi
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
-public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysConfig, SysConfig> implements ISysConfigService {
|
|
|
|
|
|
+public class SysConfigServiceImpl extends SystemService<SysConfig> implements ISysConfigService {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private SysConfigMapper sysConfigMapper;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private RedisCache redisCache;
|
|
private RedisCache redisCache;
|
|
|
|
|
|
@@ -51,7 +57,7 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
|
|
public SysConfig selectConfigById(Long configId) {
|
|
public SysConfig selectConfigById(Long configId) {
|
|
SysConfig config = new SysConfig();
|
|
SysConfig config = new SysConfig();
|
|
config.setConfigId(configId);
|
|
config.setConfigId(configId);
|
|
- return baseDao.selectConfig(config);
|
|
|
|
|
|
+ return sysConfigMapper.selectConfig(config);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -69,7 +75,7 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
|
|
}
|
|
}
|
|
SysConfig config = new SysConfig();
|
|
SysConfig config = new SysConfig();
|
|
config.setConfigKey(configKey);
|
|
config.setConfigKey(configKey);
|
|
- SysConfig retConfig = baseDao.selectConfig(config);
|
|
|
|
|
|
+ SysConfig retConfig = sysConfigMapper.selectConfig(config);
|
|
if (StringUtils.isNotNull(retConfig))
|
|
if (StringUtils.isNotNull(retConfig))
|
|
{
|
|
{
|
|
redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue());
|
|
redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue());
|
|
@@ -101,7 +107,14 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public List<SysConfig> selectConfigList(SysConfig config) {
|
|
public List<SysConfig> selectConfigList(SysConfig config) {
|
|
- return baseDao.selectConfigList(config);
|
|
|
|
|
|
+ return sysConfigMapper.selectConfigList(config);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public TableDataInfo<SysConfig> selectConfigList(PageDomain pageDomain, SysConfig config)
|
|
|
|
+ {
|
|
|
|
+ Page<SysConfig> page = convertToPage(pageDomain);
|
|
|
|
+ return getDataTable(sysConfigMapper.selectConfigList(page,config));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -112,7 +125,7 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public int insertConfig(SysConfig config) {
|
|
public int insertConfig(SysConfig config) {
|
|
- int row = baseDao.insertConfig(config);
|
|
|
|
|
|
+ int row = sysConfigMapper.insertConfig(config);
|
|
if (row > 0)
|
|
if (row > 0)
|
|
{
|
|
{
|
|
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
|
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
|
@@ -128,13 +141,13 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public int updateConfig(SysConfig config) {
|
|
public int updateConfig(SysConfig config) {
|
|
- SysConfig temp = baseDao.selectConfigById(config.getConfigId());
|
|
|
|
|
|
+ SysConfig temp = sysConfigMapper.selectConfigById(config.getConfigId());
|
|
if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey()))
|
|
if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey()))
|
|
{
|
|
{
|
|
redisCache.deleteObject(getCacheKey(temp.getConfigKey()));
|
|
redisCache.deleteObject(getCacheKey(temp.getConfigKey()));
|
|
}
|
|
}
|
|
|
|
|
|
- int row = baseDao.updateConfig(config);
|
|
|
|
|
|
+ int row = sysConfigMapper.updateConfig(config);
|
|
if (row > 0)
|
|
if (row > 0)
|
|
{
|
|
{
|
|
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
|
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
|
@@ -156,7 +169,7 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
|
|
{
|
|
{
|
|
throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
|
|
throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
|
|
}
|
|
}
|
|
- baseDao.deleteConfigById(configId);
|
|
|
|
|
|
+ sysConfigMapper.deleteConfigById(configId);
|
|
redisCache.deleteObject(getCacheKey(config.getConfigKey()));
|
|
redisCache.deleteObject(getCacheKey(config.getConfigKey()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -166,7 +179,7 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public void loadingConfigCache() {
|
|
public void loadingConfigCache() {
|
|
- List<SysConfig> configsList = baseDao.selectConfigList(new SysConfig());
|
|
|
|
|
|
+ List<SysConfig> configsList = sysConfigMapper.selectConfigList(new SysConfig());
|
|
for (SysConfig config : configsList)
|
|
for (SysConfig config : configsList)
|
|
{
|
|
{
|
|
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
|
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
|
@@ -200,7 +213,7 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
|
|
@Override
|
|
@Override
|
|
public boolean checkConfigKeyUnique(SysConfig config) {
|
|
public boolean checkConfigKeyUnique(SysConfig config) {
|
|
Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
|
|
Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
|
|
- SysConfig info = baseDao.checkConfigKeyUnique(config.getConfigKey());
|
|
|
|
|
|
+ SysConfig info = sysConfigMapper.checkConfigKeyUnique(config.getConfigKey());
|
|
if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue())
|
|
if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue())
|
|
{
|
|
{
|
|
return UserConstants.NOT_UNIQUE;
|
|
return UserConstants.NOT_UNIQUE;
|
|
@@ -219,8 +232,5 @@ public class SysConfigServiceImpl extends CrudServiceImpl<SysConfigMapper, SysCo
|
|
return CacheConstants.SYS_CONFIG_KEY + configKey;
|
|
return CacheConstants.SYS_CONFIG_KEY + configKey;
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- public QueryWrapper<SysConfig> getWrapper(Map<String, Object> params) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|