From 531ba0bfed01a43d4a2d537ee00ee9678402e148 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 2 Feb 2026 03:29:47 +0000 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E9=9A=A7=E9=81=93=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=BF=BD=E5=8A=A0=E5=88=B0=E6=9C=AB=E5=B0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/admin/service/impl/TunnelServiceImpl.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/springboot-backend/src/main/java/com/admin/service/impl/TunnelServiceImpl.java b/springboot-backend/src/main/java/com/admin/service/impl/TunnelServiceImpl.java index 5f7e60a..5dd6527 100644 --- a/springboot-backend/src/main/java/com/admin/service/impl/TunnelServiceImpl.java +++ b/springboot-backend/src/main/java/com/admin/service/impl/TunnelServiceImpl.java @@ -117,6 +117,19 @@ public class TunnelServiceImpl extends ServiceImpl impleme long currentTime = System.currentTimeMillis(); tunnel.setCreatedTime(currentTime); tunnel.setUpdatedTime(currentTime); + + // When tunnels are ordered via `inx`, new tunnels should be appended. + // Only apply this when an order already exists (max `inx` > 0) to avoid + // changing behavior for deployments still relying on local ordering. + Tunnel lastByInx = this.getOne(new QueryWrapper() + .select("inx") + .orderByDesc("inx") + .orderByDesc("id") + .last("LIMIT 1")); + Integer maxInx = lastByInx == null ? null : lastByInx.getInx(); + if (maxInx != null && maxInx > 0) { + tunnel.setInx(maxInx + 1); + } if (StringUtils.isEmpty(tunnel.getInIp())){ java.util.LinkedHashSet inIps = new java.util.LinkedHashSet<>(); for (ChainTunnel chainTunnel : tunnelDto.getInNodeId()) {