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

fix(单位模块): 修改了更新单位性质的时候会把单位类型也改掉

修改了更新单位性质的时候会把单位类型也改掉
上级 4036eb4b
......@@ -98,4 +98,12 @@ public class UnitsCache {
return unitsList.stream().sorted(Comparator.comparing(Units::getShowOrder)).collect(Collectors.toList());
}
/**
* 根据单位名称查询是否存在
*/
public boolean isNotName(String name){
return new ArrayList<>(idMap.values()).stream().allMatch(units -> !units.getName().equals(name));
}
}
......@@ -541,6 +541,8 @@ public class UnitsServiceImpl implements UnitsService {
Units unitsOld=unitsCache.findById(units.getUnitId());
if (!units.getLevel().equals(unitsOld.getLevel())){
units.setType(levelToType(units.getLevel()));
}else {
units.setType(unitsOld.getType());
}
//原来上级单位对象
Units parentUnitOld= findByParentUnit(unitsOld);
......@@ -639,6 +641,9 @@ public class UnitsServiceImpl implements UnitsService {
@Override
public Units save(Units units) {
// if (!unitsCache.isNotName(units.getName())){
//
// }
if (units.getAreaId() != null && units.getAreaId() != 0) {
Optional<Area> optionalArea = areaDao.findById(units.getAreaId());
if (optionalArea.isPresent()) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论