统计报表-电池温度数据
This commit is contained in:
@ -346,12 +346,36 @@
|
||||
t.avg_cell_temp as batteryTemp,
|
||||
t.create_time as createDate
|
||||
from ems_battery_cluster t
|
||||
inner join (select site_id,create_time,MIN(device_id) as device_id
|
||||
inner join (select site_id,create_time,MIN(device_id) as device_id
|
||||
from ems_battery_cluster
|
||||
where site_id = #{siteId}
|
||||
AND create_time >= Date(#{startDate})
|
||||
AND create_time <= #{endDate}
|
||||
GROUP BY site_id,create_time
|
||||
AND create_time >= Date(#{startDate})
|
||||
AND create_time <= #{endDate}
|
||||
GROUP BY site_id,create_time
|
||||
) temp on t.site_id = temp.site_id and t.create_time = temp.create_time and t.device_id = temp.device_id
|
||||
</select>
|
||||
|
||||
<select id="getClusterDataByHour" resultType="com.xzzn.ems.domain.vo.ClusterStatisListVo">
|
||||
SELECT latest.statisDate,
|
||||
t.max_cell_temp as maxTemp,
|
||||
t.max_cell_temp_id as maxTempId,
|
||||
t.min_cell_temp as minTemp,
|
||||
t.min_cell_temp_id as minTempId,
|
||||
t.max_cell_voltage as maxVoltage,
|
||||
t.max_cell_voltage_id as maxVoltageId,
|
||||
t.min_cell_voltage as minVoltage,
|
||||
t.min_cell_voltage_id as minVoltageId
|
||||
FROM ( SELECT p.site_id, p.device_id, DATE_FORMAT( p.update_time, '%H' ) AS statisDate, MAX(p.update_time) AS max_update_time
|
||||
FROM ems_battery_cluster p
|
||||
WHERE p.stack_device_id = #{stackId}
|
||||
AND p.device_id = #{clusterId}
|
||||
AND DATE( p.update_time) = DATE(#{dateTime})
|
||||
GROUP BY p.site_id, p.device_id, statisDate
|
||||
) latest
|
||||
INNER JOIN ems_battery_cluster t ON latest.site_id = t.site_id
|
||||
AND latest.device_id = t.device_id
|
||||
AND latest.max_update_time = t.update_time
|
||||
GROUP BY statisDate, maxTemp, maxTempId, minTemp, minTempId, maxVoltage, maxVoltageId, minVoltage, minVoltageId
|
||||
ORDER BY statisDate
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user