缓存修改
This commit is contained in:
parent
121be10ada
commit
21bce7651c
@ -19,6 +19,7 @@ public class RegDictCache {
|
|||||||
* @param regDictList 字典数据列表
|
* @param regDictList 字典数据列表
|
||||||
*/
|
*/
|
||||||
public static void setDictCache(String key, List<RegDict> regDictList) {
|
public static void setDictCache(String key, List<RegDict> regDictList) {
|
||||||
|
removeDictCache(key);
|
||||||
SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), regDictList);
|
SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), regDictList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -119,10 +119,13 @@ public class RegDictServiceImpl implements RegDictService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteDictById(Long DictId) {
|
public int deleteDictById(Long DictId) {
|
||||||
int i = dictMapper.deleteDictById(DictId);
|
|
||||||
//设置缓存
|
//设置缓存
|
||||||
RegDict regDict = dictMapper.selectDictById(DictId);
|
RegDict regDict = dictMapper.selectDictById(DictId);
|
||||||
RegDictCache.setDictCache(regDict.getDictType(),dictMapper.getInfoOne(regDict.getDictType(),null));
|
int i = dictMapper.deleteDictById(DictId);
|
||||||
|
if(regDict != null){
|
||||||
|
RegDictCache.setDictCache(regDict.getDictType(),dictMapper.getInfoOne(regDict.getDictType(),null));
|
||||||
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,13 +143,13 @@ public class RegDictServiceImpl implements RegDictService {
|
|||||||
throw new ServiceException(String.format("%1$s已分配,不能删除", Dict.getDictName()));
|
throw new ServiceException(String.format("%1$s已分配,不能删除", Dict.getDictName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RegDict regDict = dictMapper.selectDictById(DictIds[0]);
|
||||||
int i = dictMapper.deleteDictByIds(DictIds);
|
int i = dictMapper.deleteDictByIds(DictIds);
|
||||||
//重新设置缓存
|
//重新设置缓存
|
||||||
RegDict regDict = new RegDict();
|
if(regDict != null){
|
||||||
regDict.setDictId(DictIds[0]);
|
RegDictCache.setDictCache(regDict.getDictType(),dictMapper.getInfoOne(regDict.getDictType(),null));
|
||||||
List<RegDict> regDictList = dictMapper.selectDictList(regDict);
|
}
|
||||||
RegDictCache.setDictCache(regDict.getDictType(),regDictList);
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user