提交 b6d967af authored 作者: zjm's avatar zjm

fix(单位模块): 更新单位之后单位排序的cache问题

更新单位之后单位排序的cache问题
上级 58e7e7c0
package com.tykj.dev.device.user.cache; package com.tykj.dev.device.user.cache;
import com.tykj.dev.device.user.subject.entity.Units; import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.misc.utils.DeviceModelSort;
import lombok.Data; import lombok.Data;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -72,6 +73,8 @@ public class UnitsCache { ...@@ -72,6 +73,8 @@ public class UnitsCache {
public UnitsCache refresh(List<Units> unitsList){ public UnitsCache refresh(List<Units> unitsList){
this.idMap = unitsList.stream().collect(Collectors.toMap(Units::getUnitId, Function.identity())); this.idMap = unitsList.stream().collect(Collectors.toMap(Units::getUnitId, Function.identity()));
this.areaIdMpa=unitsList.stream().collect(Collectors.toMap(Units::getAreaId,Function.identity())); this.areaIdMpa=unitsList.stream().collect(Collectors.toMap(Units::getAreaId,Function.identity()));
DeviceModelSort.mapUnitSort = unitsList.stream().collect(Collectors.toMap(Units::getName, Units::getShowOrder));
DeviceModelSort.mapUnitNameToDisName = unitsList.stream().collect(Collectors.toMap(Units::getName, Units::getUnitDesc));
return this; return this;
} }
...@@ -103,7 +106,7 @@ public class UnitsCache { ...@@ -103,7 +106,7 @@ public class UnitsCache {
* 根据单位名称查询是否存在 * 根据单位名称查询是否存在
*/ */
public boolean isNotName(String name){ public boolean isNotName(String name){
return new ArrayList<>(idMap.values()).stream().noneMatch(units -> units.getName().equals(name)); return new ArrayList<>(idMap.values()).stream().noneMatch(units -> units.getName().equals(name));
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论