From a127882c8f15593783fcf0a1489835c16db70682 Mon Sep 17 00:00:00 2001
From: whycxzp <glperry@163.com>
Date: 星期一, 31 三月 2025 00:51:54 +0800
Subject: [PATCH] 电池站点温度历史,按摄像头id,月分表

---
 src/main/java/com/whyc/service/BattStationTempHisService.java |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/whyc/service/BattStationTempHisService.java b/src/main/java/com/whyc/service/BattStationTempHisService.java
index 2109e8f..cfc2a20 100644
--- a/src/main/java/com/whyc/service/BattStationTempHisService.java
+++ b/src/main/java/com/whyc/service/BattStationTempHisService.java
@@ -1,12 +1,18 @@
 package com.whyc.service;
 
+import com.github.pagehelper.PageInfo;
+import com.whyc.dto.Response;
 import com.whyc.mapper.BattStationTempHisMapper;
 import com.whyc.mapper.CommonMapper;
 import com.whyc.pojo.db_power_history.BattStationTempHistory;
+import com.whyc.util.SubTablePageInfoUtil;
+import com.whyc.util.ThreadLocalUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.text.ParseException;
+import java.util.List;
 
 @Service
 public class BattStationTempHisService {
@@ -20,6 +26,9 @@
     @Autowired
     private JdbcSqlExecuteService jdbcSqlExecuteService;
 
+    @Autowired
+    private SubTablePageInfoUtil pageInfoUtil;
+
     public void createTableByMonth(Integer battGroupId,String yearMonth) {
         jdbcSqlExecuteService.execute("CREATE TABLE IF NOT EXISTS `db_power_history`.`db_batt_station_temp_history_"+yearMonth+"` LIKE `db_power_history`.`db_batt_station_temp_history`");
     }
@@ -32,4 +41,9 @@
         jdbcSqlExecuteService.execute("INSERT INTO `db_power_history`.`db_batt_station_temp_history_"+battGroupId+"_"+yearMonth+"` (`batt_group_id`, `station_id`, `pixel_x`, `pixel_y`, `max_temp`, `min_temp`, `min_temp_point`, `max_temp_point`, `camera_id`, `record_time`)" +
                 "\n values("+tempHistory.getBattGroupId()+","+tempHistory.getStationId()+","+tempHistory.getPixelX()+","+tempHistory.getPixelY()+","+tempHistory.getMaxTemp()+","+tempHistory.getMinTemp()+",'"+tempHistory.getMinTempPoint()+"','"+tempHistory.getMaxTempPoint()+"','"+tempHistory.getCameraId()+"','"+tempHistory.getRecordTime());
     }
+
+    public Response getPageByCameraId(int pageNum, int pageSize, String cameraId, String startTime, String endTime) throws ParseException, InterruptedException {
+        PageInfo<Object> pageInfo = pageInfoUtil.getPageInfoByMonthTable(pageNum, pageSize, ThreadLocalUtil.parse(startTime, 1), ThreadLocalUtil.parse(endTime, 1), "db_power_history", "tb_batt_station_temp_history_" + cameraId, new BattStationTempHistory());
+        return new Response().set(1, pageInfo);
+    }
 }

--
Gitblit v1.9.1