提交 1ae52381 authored 作者: zjm's avatar zjm

fix(单位模块): 地区修改描述,提示名字重复的问题

地区修改描述,提示名字重复的问题
上级 07aeee7d
......@@ -57,11 +57,12 @@ public class AreaExhibitionServiceImpl implements AreaExhibitionService {
@Override
public AreaExhibition save(AreaExhibition areaExhibition) {
if (!areaExhibitionCache.isNotName(areaExhibition.getAreaName())){
throw new ApiException(ResponseEntity.status(20020).body("区域名称重复"));
}
if (areaExhibition.getId()==null){
areaExhibition.setOrders(areaExhibitionCache.findAll().size()+1);
if (!areaExhibitionCache.isNotName(areaExhibition.getAreaName())){
throw new ApiException(ResponseEntity.status(20020).body("区域名称重复"));
}
}else {
AreaExhibition oldAreaExhibition = areaExhibitionCache.findById(areaExhibition.getId());
int count=areaExhibitionCache.findAll().size();
......@@ -72,6 +73,12 @@ public class AreaExhibitionServiceImpl implements AreaExhibitionService {
sortingAreaExhibition(areaExhibition.getOrders(),oldAreaExhibition.getOrders());
}
}
if (!areaExhibition.getAreaName().equals(oldAreaExhibition.getAreaName())){
if (!areaExhibitionCache.isNotName(areaExhibition.getAreaName())) {
throw new ApiException(ResponseEntity.status(20020).body("区域名称重复"));
}
}
}
AreaExhibition areaExhibition1= areaExhibitionDao.save(areaExhibition);
areaExhibitionCache.refresh(areaExhibitionDao.findAll());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论