提交 42776efc authored 作者: zjm's avatar zjm

fix(库房模块): 把缓存中ID转name的方法转换成静态的

把缓存中ID转name的方法转换成静态的
上级 ce787799
......@@ -323,8 +323,6 @@ public class DeviceLibrary implements Serializable {
return mapper.map(this, DeviceExcel.class);
}
@Autowired
StoreCache storeCache;
public DeviceLibrary setConfigName(){
ConfigCache configCache = SpringUtils.getBean("initConfigCache");
......@@ -337,7 +335,7 @@ public class DeviceLibrary implements Serializable {
setStorageTypeName(configCache.getStorageTypeMap().get(this.storageType)==null?"-":configCache.getStorageTypeMap().get(this.storageType));
setAllotTypeName(configCache.getAllotTypeMap().get(this.allotType)==null?"-":configCache.getAllotTypeMap().get(this.allotType));
// childs.clear();
setStorageLocation(storeCache.idToName(this.storageLocationId));
setStorageLocation(StoreCache.idToName(this.storageLocationId));
}
return this;
}
......
......@@ -27,13 +27,17 @@ public class StoreCache {
idMap = unitStoreLocations.stream().collect(Collectors.toMap(UnitStoreLocation::getId, UnitStoreLocation::getStoreName));
}
public StoreCache() {
}
public StoreCache refresh(List<UnitStoreLocation> unitStoreLocations) {
idMap = unitStoreLocations.stream().collect(Collectors.toMap(UnitStoreLocation::getId, UnitStoreLocation::getStoreName));
return this;
}
public String idToName(Integer id){
return idMap.getOrDefault(id, "");
public static String idToName(Integer id){
StoreCache storeCache= new StoreCache();
return storeCache.idMap.getOrDefault(id, "");
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论