Commit 7e88f405 authored by fangxinjiang's avatar fangxinjiang

清理字典缓存-缓存更新

parent c9e3d48c
......@@ -143,7 +143,7 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
List<SysDictItem> allList = baseMapper.selectList(Wrappers.<SysDictItem>query().lambda()
.in(SysDictItem::getType,type)
.eq(SysDictItem::getDelFlag,CommonConstants.ZERO_STRING));
extracted(allList, resultMap);
extractedCache(allList, resultMap);
}
/**
......@@ -245,7 +245,7 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
}
log.info("字典数据加入缓存初始化结束...");
}
private void extracted(List<SysDictItem> allList, Map<String, Object> resultMap) {
private void extractedCache(List<SysDictItem> allList, Map<String, Object> resultMap) {
if (Common.isNotNull(allList)){
if (Common.isEmpty(resultMap)){
resultMap = new HashMap<>();
......@@ -255,7 +255,21 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
}
}
}
private void extracted(List<SysDictItem> allList, Map<String, Object> resultMap) {
if (Common.isNotNull(allList)){
for (SysDictItem item : allList) {
String dictCode = item.getType();
if (resultMap.get(dictCode) == null) {
Map<String, Object> dictMap = new HashMap<String, Object>();
dictMap.put(item.getValue(), item.getLabel());
resultMap.put(dictCode, dictMap);
} else {
Map dictMap = (Map) resultMap.get(dictCode);
dictMap.put(item.getValue(), item.getLabel());
}
}
}
}
@Override
public R<Map<String, Map<String, String>>> getDictToLable() {
Map<String, Map<String, String>> resultMap = this.getStringMapMap(false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment