From 65ba1bb7615d5c900cff9c18995ad99e3a73d11a Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期四, 27 八月 2026 23:02:47 +0800
Subject: [PATCH] fix: preserve battery group field types

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBatteryGroupFieldServiceImpl.java |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBatteryGroupFieldServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBatteryGroupFieldServiceImpl.java
index bfd2f78..c88e51a 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBatteryGroupFieldServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBatteryGroupFieldServiceImpl.java
@@ -2,6 +2,7 @@
 
 import java.util.Date;
 import java.util.List;
+import java.util.Set;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -21,7 +22,7 @@
 {
     private static final String NORMAL = "0";
     private static final String DISABLED = "1";
-    private static final String TEXT = "text";
+    private static final Set<String> SUPPORTED_FIELD_TYPES = Set.of("text", "number", "time", "remark");
 
     @Autowired
     private TBatteryGroupFieldMapper batteryGroupFieldMapper;
@@ -147,9 +148,9 @@
         {
             throw new ServiceException("字段类型不能为空");
         }
-        if (!TEXT.equals(field.getFieldType()))
+        if (!SUPPORTED_FIELD_TYPES.contains(field.getFieldType()))
         {
-            throw new ServiceException("字段类型仅支持text(文字)");
+            throw new ServiceException("字段类型仅支持text、number、time或remark");
         }
         if (field.getRemark() != null && field.getRemark().length() > 500)
         {

--
Gitblit v1.7.1