diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java index fbd41c0..f9b8d6b 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java @@ -89,8 +89,11 @@ public class StationServiceImpl extends BaseServiceImpl { throw new ServiceException("创建/修改机构失败!"); }); - Optional sort = Optional.ofNullable(this.getStationMaxOrder()); - req.setSort(sort.isPresent() ? sort.get() + 1 : 1); + // 区分新增和修改站点信息,若为新增,则排序递增,否则不变 + if (req.getId() == null) { + Optional sort = Optional.ofNullable(this.getStationMaxOrder()); + req.setSort(sort.isPresent() ? sort.get() + 1 : 1); + } boolean updateResult = this.saveOrUpdate(req); Assert.isTrue(updateResult, () -> { throw new ServiceException("创建/修改站点信息失败!");