This commit is contained in:
2025-06-29 14:45:20 +08:00
parent aed3f830f5
commit 324beeaa69
7 changed files with 20 additions and 20 deletions

View File

@ -311,7 +311,7 @@
tmp.total_current as totalCurrent,tmp.dischargeable_capacity as dischargeableCapacity,tmp.total_discharged_capacity as totalDischargedCapacity,
tmp.soh as soh,tmp.average_temperature as averageTemperature,tmp.insulation_resistance as insulationResistance,
tmp.current_soc as currentSoc,tmp.site_id as siteId,tmp.device_id as deviceId
from ems_battery_stack tmp left join ems_devices_setting td on tmp.device_id = td.id and tmp.site_id = td.site_id
from ems_battery_stack tmp left join ems_devices_setting td on tmp.device_id = td.device_id and tmp.site_id = td.site_id
where tmp.site_id = #{siteId}
and tmp.update_time = (select MAX(t.update_time) FROM ems_battery_stack t where t.site_id = tmp.site_id
and t.device_id = tmp.device_id)

View File

@ -125,12 +125,12 @@
</delete>
<select id="getCoolingDataList" parameterType="String" resultMap="EmsCoolingDataResult">
select t.*
from ems_cooling_data t
where t.site_id = #{siteId}
and t.update_time = (
select MAX(tcd.update_time) from ems_cooling_data tcd where tcd.site_id = t.site_id and tcd.device_id = t.device_id)
order by t.system_name
SELECT t.*
FROM ( SELECT *, ROW_NUMBER() OVER (PARTITION BY device_id ORDER BY update_time DESC ) AS rn
FROM ems_cooling_data
WHERE site_id = #{siteId}
) t
WHERE rn = 1
ORDER BY system_name
</select>
</mapper>

View File

@ -205,14 +205,15 @@
</delete>
<select id="getPcsBranchInfoList" resultType="com.xzzn.ems.domain.vo.PcsBranchInfo">
select tmp.branch_id as branchId, tmp.discharge_status as dischargeStatus,
SELECT tmp.branch_id as branchId, tmp.discharge_status as dischargeStatus,
tmp.dc_power as dcPower, tmp.dc_voltage as dcVoltage,
tmp.dc_current as dcCurrent, tmp.site_id as siteId, tmp.device_id as deviceId
from ems_pcs_branch_data tmp
where tmp.site_id = #{siteId}
and tmp.device_id = #{deviceId}
and tmp.update_time = (select MAX(t.update_time) FROM ems_pcs_branch_data t where t.site_id = tmp.site_id
and t.device_id = tmp.device_id and t.branch_id = tmp.branch_id)
order by tmp.branch_id
FROM (
SELECT t.*, ROW_NUMBER() OVER ( PARTITION BY t.branch_id ORDER BY t.update_time DESC ) AS rn
FROM ems_pcs_branch_data t
WHERE t.site_id = #{siteId} AND t.device_id = #{deviceId}
) tmp
WHERE rn = 1
ORDER BY tmp.branch_id;
</select>
</mapper>

View File

@ -349,7 +349,7 @@
tmp.c_phase_current as cPhaseVoltage,tmp.c_phase_current as cPhaseCurrent,
tmp.total_power_factor as totalPowerFactor,
tmp.pcs_environment_temperature as pcsEnvironmentTemperature,tmp.ac_frequency as acFrequency
from ems_pcs_data tmp left join ems_devices_setting td on tmp.device_id = td.id and tmp.site_id = td.site_id
from ems_pcs_data tmp left join ems_devices_setting td on tmp.device_id = td.device_id and tmp.site_id = td.site_id
where tmp.site_id = #{siteId}
and tmp.data_update_time = (select MAX(data_update_time) FROM ems_pcs_data where site_id = tmp.site_id
and device_id = tmp.device_id)