This commit is contained in:
sxu 2025-04-29 10:08:56 +08:00
parent faf6075b08
commit 3a160c97f8
1 changed files with 8 additions and 2 deletions

View File

@ -70,7 +70,7 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
} }
return allocAreaMapper.insertAllocArea(allocArea); return allocAreaMapper.insertAllocArea(allocArea);
} catch (Exception e) { } catch (Exception e) {
throw new ServiceException("新增异常," + e.getMessage()); throw new ServiceException("新增区域异常," + e.getMessage());
} }
} }
@ -84,9 +84,15 @@ public class AllocAreaServiceImpl implements IAllocAreaService {
public int updateAllocArea(AllocArea allocArea) { public int updateAllocArea(AllocArea allocArea) {
allocArea.setUpdateTime(DateUtils.getNowDate()); allocArea.setUpdateTime(DateUtils.getNowDate());
try { try {
List<AllocArea> allAreaList = allocAreaMapper.selectAllocAreaList(new AllocArea());
List<String> otherAreaNameList = allAreaList.stream().filter(item -> !item.getAreaId().equals(allocArea.getAreaId()))
.map(AllocArea::getAreaName).collect(Collectors.toList());
if (otherAreaNameList.contains(allocArea.getAreaName())) {
throw new ServiceException("区域名称已存在");
}
return allocAreaMapper.updateAllocArea(allocArea); return allocAreaMapper.updateAllocArea(allocArea);
} catch (Exception e) { } catch (Exception e) {
throw new ServiceException("错误信息描述"); throw new ServiceException("更新区域失败," + e.getMessage());
} }
} }