From 6554520c19965b343ceb06c36c8da0714f385ddd Mon Sep 17 00:00:00 2001 From: liwen Date: Wed, 27 Mar 2024 21:11:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E7=AB=99=E7=82=B9?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=B6=E6=8E=92=E5=BA=8F=E4=BC=9A=E9=80=92?= =?UTF-8?q?=E5=A2=9E=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/station/service/impl/StationServiceImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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("创建/修改站点信息失败!");