From bc56530307e0e92b94a1abb5d38368f04b92e990 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期四, 12 三月 2026 15:52:15 +0800
Subject: [PATCH] 1

---
 component/component-Influxdb/src/main/java/com/zy/component/influxdb/service/InfluxDBService.java |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/component/component-Influxdb/src/main/java/com/zy/component/influxdb/service/InfluxDBService.java b/component/component-Influxdb/src/main/java/com/zy/component/influxdb/service/InfluxDBService.java
index eaf78eb..924ee65 100644
--- a/component/component-Influxdb/src/main/java/com/zy/component/influxdb/service/InfluxDBService.java
+++ b/component/component-Influxdb/src/main/java/com/zy/component/influxdb/service/InfluxDBService.java
@@ -6,6 +6,7 @@
 import com.influxdb.v3.client.query.QueryOptions;
 import com.influxdb.v3.client.query.QueryType;
 import com.influxdb.v3.client.write.WritePrecision;
+import com.zy.component.influxdb.domain.BaseMessage;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,6 +16,7 @@
 import java.lang.reflect.InvocationTargetException;
 import java.time.Instant;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -28,8 +30,6 @@
 
     @Autowired
     private InfluxDBClient influxDBClient;
-
-
 
     /**
      * 鍐欏叆鏁版嵁
@@ -70,17 +70,25 @@
         }
         return null;
     }
-
     /**
      * 鏌ヨ鏁版嵁
      *
      * @param sql sql璇彞
      * @return 鏌ヨ缁撴灉鍒楄〃
      */
-    public <T> List<T> queryPoints(String sql, Class<T> clazz) {
+    public <T  extends BaseMessage> List<T> queryPoints(String sql, Class<T> clazz) {
+       return queryPoints(sql,new HashMap<>(),clazz);
+    }
+    /**
+     * 鏌ヨ鏁版嵁
+     *
+     * @param sql sql璇彞
+     * @return 鏌ヨ缁撴灉鍒楄〃
+     */
+    public <T  extends BaseMessage> List<T> queryPoints(String sql,Map<String,Object> queryParams, Class<T> clazz) {
         try {
             // 鎵ц鏌ヨ
-            Stream<PointValues> queryPoints = influxDBClient.queryPoints(sql);
+            Stream<PointValues> queryPoints = influxDBClient.queryPoints(sql, queryParams);
             Field[] declaredFields = clazz.getDeclaredFields();
                 
             // 鍒涘缓涓�涓垪琛ㄧ敤浜庡瓨鍌ㄧ粨鏋�
@@ -126,10 +134,9 @@
                         }
                     }
                 }
+                newInstance.setTimestamp(point.getTimestamp().longValue());
                 return newInstance;
             }).collect(Collectors.toList());
-                
-            logger.info("鏌ヨ鏁版嵁锛歿}", result);
             return result;
         } catch (Exception e) {
             logger.error("Failed to query data from the database.");

--
Gitblit v1.9.1