From 85eb2837e3b3bf5411b332aa2cc38d2755e0d3bf Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期六, 05 九月 2026 01:27:19 +0800
Subject: [PATCH] 完成电池组当前字段与测试绑定

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBatteryGroupServiceImpl.java |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBatteryGroupServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBatteryGroupServiceImpl.java
index 9ca780c..d682c17 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBatteryGroupServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBatteryGroupServiceImpl.java
@@ -203,10 +203,11 @@
             {
                 throw new ServiceException("电池号不能重复或为空");
             }
+            // 电池号只要求在所属电池组内唯一;不同电池组可以复用同一业务编号。
             TBatteryGroupBattery existingBattery = batteryGroupMapper.selectBatteryByNo(normalized, group.getGroupId());
-            if (existingBattery != null && (group.getGroupId() == null || !group.getGroupId().equals(existingBattery.getGroupId())))
+            if (!update && existingBattery != null)
             {
-                throw new ServiceException("电池号已被其他电池组使用");
+                throw new ServiceException("所属电池组内电池号已存在");
             }
         }
         if (group.getTemplateId() == null)

--
Gitblit v1.7.1