From 39b74c6fb4a50bed412bbebdd38440d384f47733 Mon Sep 17 00:00:00 2001 From: whycxzp <glperry@163.com> Date: 星期日, 30 三月 2025 14:40:18 +0800 Subject: [PATCH] 完善温度告警 --- src/main/java/com/whyc/service/BattStationTempHisService.java | 21 +++++++++++++++++++-- 1 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/whyc/service/BattStationTempHisService.java b/src/main/java/com/whyc/service/BattStationTempHisService.java index 0dd3395..2109e8f 100644 --- a/src/main/java/com/whyc/service/BattStationTempHisService.java +++ b/src/main/java/com/whyc/service/BattStationTempHisService.java @@ -1,6 +1,9 @@ package com.whyc.service; import com.whyc.mapper.BattStationTempHisMapper; +import com.whyc.mapper.CommonMapper; +import com.whyc.pojo.db_power_history.BattStationTempHistory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -11,8 +14,22 @@ @Resource private BattStationTempHisMapper mapper; - public void createTableByMonth(Integer battGroupId,String month) { - mapper.createTableByMonth(battGroupId,month); + @Resource + private CommonMapper commonMapper; + + @Autowired + private JdbcSqlExecuteService jdbcSqlExecuteService; + + 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`"); } + public boolean existTempHisTableByMonth(Integer battGroupId, String yearMonth) { + return commonMapper.existTable("db_power_history","db_batt_station_temp_history_"+battGroupId+"_"+yearMonth); + } + + public void add(Integer battGroupId, String yearMonth, BattStationTempHistory tempHistory) { + 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()); + } } -- Gitblit v1.9.1