修改site_id & device_id

This commit is contained in:
2025-06-29 10:55:05 +08:00
parent 177e235c0e
commit d1aa8dbd2c
50 changed files with 2142 additions and 336 deletions

View File

@ -87,7 +87,7 @@
<if test="dcPower != null "> and dc_power = #{dcPower}</if>
<if test="dcVoltage != null "> and dc_voltage = #{dcVoltage}</if>
<if test="dcCurrent != null "> and dc_current = #{dcCurrent}</if>
<if test="siteId != null "> and site_id = #{siteId}</if>
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
<if test="dateMonth != null "> and date_month = #{dateMonth}</if>
<if test="dateDay != null "> and date_day = #{dateDay}</if>
@ -278,4 +278,81 @@
#{id}
</foreach>
</delete>
<select id="getPcsDataBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
select CONCAT(date_month,'/',date_day) as ammeterDate,
sum(daily_ac_charge_energy) as chargedCap,
sum(daily_ac_discharge_energy) as disChargedCap
from ems_pcs_data
where site_id = #{siteId}
and date_sub(CURDATE(), interval 6 day) &lt;= create_time
group by date_month,date_day
</select>
<select id="getGridNrtPower" parameterType="String" resultType="java.math.BigDecimal">
select sum(total_active_power) as gridNrtPower
from ems_pcs_data
where site_id = #{siteId}
</select>
<select id="getPcsTotalChargeData" resultType="map">
select SUM(t.daily_ac_charge_energy) as totalChargedCap,
SUM(t.daily_ac_discharge_energy) as totalDischargedCap
from ems_pcs_data t
where t.data_update_time = (select MAX(data_update_time) FROM ems_pcs_data
where site_id = t.site_id and device_id = t.device_id and date_month = t.date_month and date_day = t.date_day)
</select>
<select id="getSiteRunningHeadInfo" parameterType="String" resultType="com.xzzn.ems.domain.vo.SiteMonitorRunningHeadInfoVo">
select sum(a.total_active_power) as totalActivePower,
sum(a.total_reactive_power) as totalReactivePower,
sum(a.daily_ac_charge_energy) as dayChargedCap,
sum(a.daily_ac_discharge_energy) as dayDisChargedCap
from (
select t.total_active_power,t.total_reactive_power,
t.daily_ac_charge_energy,t.daily_ac_discharge_energy,
t.device_id,t.site_id,t.create_time
from ems_pcs_data t
where t.site_id = #{siteId}
and t.create_time = (select MAX(create_time) FROM ems_pcs_data where site_id = t.site_id and device_id = t.device_id)
group by t.device_id,t.total_active_power, total_reactive_power,
t.daily_ac_charge_energy,t.daily_ac_discharge_energy,t.site_id,t.create_time
) a
</select>
<select id="getElectDataList" resultType="com.xzzn.ems.domain.vo.ElectricIndexList">
select tmp.date_month as dateMonth,
SUM(tmp.daily_ac_charge_energy) as chargeEnergy,
SUM(tmp.daily_ac_discharge_energy) as disChargeEnergy
from (
select date_month,date_day,t.daily_ac_charge_energy,t.daily_ac_discharge_energy,t.create_time
from ems_pcs_data t
where t.create_time = (select MAX(create_time) FROM ems_pcs_data where site_id = t.site_id
and device_id = t.device_id and date_day = t.date_day and date_month = t.date_month)
) as tmp
group by dateMonth
</select>
<select id="getPcsDetailInfoBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.vo.PcsDetailInfoVo">
select td.device_name as deviceName,
td.communication_status as communicationStatus,
tmp.site_id as siteId,
tmp.device_id as deviceId,
tmp.data_update_time as dataUpdateTime,tmp.work_status as workStatus,
tmp.grid_status as gridStatus,tmp.device_status as deviceStatus,tmp.control_mode as controlMode,
tmp.total_active_power as totalActivePower,tmp.daily_ac_charge_energy as dailyAcChargeEnergy,
tmp.a_phase_voltage as aPhaseVoltage,tmp.a_phase_current as aPhaseCurrent,
tmp.total_reactive_power as totalReactivePower,tmp.daily_ac_discharge_energy as dailyAcDischargeEnergy,
tmp.b_phase_voltage as bPhaseVoltage,tmp.b_phase_current as bPhaseCurrent,
tmp.total_apparent_power as totalApparentPower,tmp.pcs_module_temperature as pcsModuleTemperature,
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
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)
order by tmp.device_id
</select>
</mapper>