单体电池修改
This commit is contained in:
@ -178,17 +178,17 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getAllBatteryDataByClusterId" resultType="com.xzzn.ems.domain.vo.BatteryDataStatsListVo">
|
<select id="getAllBatteryDataByClusterId" resultType="com.xzzn.ems.domain.vo.BatteryDataStatsListVo">
|
||||||
SELECT t.update_time as updateTime, t.voltage, t.temperature,
|
SELECT t.data_timestamp as updateTime, t.voltage, t.temperature,
|
||||||
t.soc, t.soh, t.device_id as deviceId
|
t.soc, t.soh, t.device_id as deviceId
|
||||||
FROM ems_battery_data t
|
FROM ems_battery_data t
|
||||||
JOIN ( SELECT device_id, MAX(update_time) AS max_update_time
|
JOIN ( SELECT device_id, MAX(data_timestamp) AS max_update_time
|
||||||
FROM ems_battery_data
|
FROM ems_battery_data
|
||||||
WHERE site_id = #{siteId}
|
WHERE site_id = #{siteId}
|
||||||
<if test="clusterDeviceId != null and clusterDeviceId != ''">
|
<if test="clusterDeviceId != null and clusterDeviceId != ''">
|
||||||
and cluster_device_id = #{clusterDeviceId}
|
and cluster_device_id = #{clusterDeviceId}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY device_id
|
GROUP BY device_id
|
||||||
) latest ON t.device_id = latest.device_id AND t.update_time = latest.max_update_time
|
) latest ON t.device_id = latest.device_id AND t.data_timestamp = latest.max_update_time
|
||||||
WHERE t.site_id = #{siteId}
|
WHERE t.site_id = #{siteId}
|
||||||
<if test="clusterDeviceId != null and clusterDeviceId != ''">
|
<if test="clusterDeviceId != null and clusterDeviceId != ''">
|
||||||
and t.cluster_device_id = #{clusterDeviceId}
|
and t.cluster_device_id = #{clusterDeviceId}
|
||||||
|
Reference in New Issue
Block a user