统计报表-pcs曲线
This commit is contained in:
@ -387,19 +387,23 @@
|
||||
order by tmp.device_id
|
||||
</select>
|
||||
|
||||
<sql id="commonFilter">
|
||||
WHERE p.site_id = #{siteId}
|
||||
<if test="startDate != null">
|
||||
AND p.data_update_time >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND p.data_update_time < #{endDate}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getPcsDataByDay" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
||||
select DATE(latest.max_update_time) as ammeterDate,
|
||||
sum(t.total_ac_charge_energy) as chargedCap,
|
||||
sum(t.total_ac_discharge_energy) as disChargedCap
|
||||
from ( SELECT p.site_id, p.device_id,p.date_month,p.date_day, MAX(p.data_update_time) AS max_update_time
|
||||
FROM ems_pcs_data p
|
||||
where p.site_id = #{siteId}
|
||||
<if test="startDate != null">
|
||||
and p.data_update_time >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
and p.data_update_time < #{endDate}
|
||||
</if>
|
||||
<include refid="commonFilter"/>
|
||||
GROUP BY p.site_id,p.device_id,p.date_month,p.date_day
|
||||
) latest inner join ems_pcs_data t ON latest.site_id = t.site_id
|
||||
AND latest.device_id = t.device_id
|
||||
@ -425,61 +429,13 @@
|
||||
) 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="getPcsAveTempList" resultType="com.xzzn.ems.domain.vo.PCSAveTempVo">
|
||||
select t.site_id,
|
||||
t.pcs_module_temperature as pcsTemp,
|
||||
t.create_time as createDate
|
||||
from ems_pcs_data t
|
||||
inner join (select site_id,create_time,MIN(device_id) as device_id
|
||||
from ems_pcs_data
|
||||
where site_id = #{siteId}
|
||||
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="getAveSocList" resultType="com.xzzn.ems.domain.vo.BatteryAveSOCVo">
|
||||
select t.site_id,
|
||||
t.battery_pack_soc as batterySOC,
|
||||
t.create_time as createDate
|
||||
from ems_battery_cluster t
|
||||
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
|
||||
) 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="getBatteryAveTempList" resultType="com.xzzn.ems.domain.vo.BatteryAveTempVo">
|
||||
select t.site_id,
|
||||
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
|
||||
from ems_battery_cluster
|
||||
where site_id = #{siteId}
|
||||
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="getPcsDataByMonth" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
||||
select DATE_FORMAT(latest.max_update_time, '%Y-%m') as ammeterDate,
|
||||
sum(t.total_ac_charge_energy) as chargedCap,
|
||||
sum(t.total_ac_discharge_energy) as disChargedCap
|
||||
from ( SELECT p.site_id, p.device_id,p.date_month,MAX(p.data_update_time) AS max_update_time
|
||||
FROM ems_pcs_data p
|
||||
where p.site_id = #{siteId}
|
||||
<if test="startDate != null">
|
||||
and p.data_update_time >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
and p.data_update_time < #{endDate}
|
||||
</if>
|
||||
<include refid="commonFilter"/>
|
||||
GROUP BY p.site_id,p.device_id,p.date_month
|
||||
) latest inner join ems_pcs_data t ON latest.site_id = t.site_id
|
||||
AND latest.device_id = t.device_id
|
||||
@ -495,13 +451,7 @@
|
||||
sum(t.total_ac_discharge_energy) as disChargedCap
|
||||
from ( SELECT p.site_id, p.device_id,DATE_FORMAT(p.data_update_time, '%H')+1 AS dateHour,MAX(p.data_update_time) as max_update_time
|
||||
FROM ems_pcs_data p
|
||||
where p.site_id = #{siteId}
|
||||
<if test="startDate != null">
|
||||
and p.data_update_time >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
and p.data_update_time < #{endDate}
|
||||
</if>
|
||||
<include refid="commonFilter"/>
|
||||
GROUP BY p.site_id,p.device_id,dateHour
|
||||
) latest inner join ems_pcs_data t ON latest.site_id = t.site_id
|
||||
AND latest.device_id = t.device_id
|
||||
@ -509,4 +459,92 @@
|
||||
group by ammeterDate
|
||||
order by ammeterDate desc
|
||||
</select>
|
||||
|
||||
<sql id="statisCommonFilter">
|
||||
WHERE p.site_id = #{siteId}
|
||||
and p.device_id = #{deviceId}
|
||||
<if test="startDate != null">
|
||||
AND p.data_update_time >= DATE(#{startDate})
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND p.data_update_time < DATE(#{endDate})
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="dataTypeChooseFilter">
|
||||
<choose>
|
||||
<when test="dataType == 1">
|
||||
t.total_active_power as activePower
|
||||
</when>
|
||||
<when test="dataType == 2">
|
||||
t.total_reactive_power as reactivePower
|
||||
</when>
|
||||
<when test="dataType == 3">
|
||||
t.sys_u_current as uCurrent,
|
||||
t.sys_v_current as vCurrent,
|
||||
t.sys_w_current as wCurrent
|
||||
</when>
|
||||
</choose>
|
||||
</sql>
|
||||
|
||||
<sql id="groupChooseFilter">
|
||||
<choose>
|
||||
<when test="dataType == 1">
|
||||
,activePower
|
||||
</when>
|
||||
<when test="dataType == 2">
|
||||
,reactivePower
|
||||
</when>
|
||||
<when test="dataType == 3">
|
||||
,uCurrent,vCurrent,wCurrent
|
||||
</when>
|
||||
</choose>
|
||||
</sql>
|
||||
<select id="getPcsActivePowerByDay" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.PcsStatisListVo">
|
||||
select CONCAT(t.date_month,'/',t.date_day) as statisDate,
|
||||
<include refid="dataTypeChooseFilter"/>
|
||||
from ( SELECT p.site_id, p.device_id,p.date_month, p.date_day,MAX(p.data_update_time) as max_update_time
|
||||
FROM ems_pcs_data p
|
||||
<include refid="statisCommonFilter"/>
|
||||
GROUP BY p.site_id,p.device_id,p.date_month,p.date_day
|
||||
) latest inner join ems_pcs_data t ON latest.site_id = t.site_id
|
||||
AND latest.device_id = t.device_id
|
||||
AND latest.max_update_time = t.data_update_time
|
||||
and latest.date_month = t.date_month
|
||||
and latest.date_day = t.date_day
|
||||
group by statisDate
|
||||
<include refid="groupChooseFilter"/>
|
||||
order by statisDate desc
|
||||
</select>
|
||||
|
||||
<select id="getPcsActivePowerByMonth" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.PcsStatisListVo">
|
||||
select DATE_FORMAT(latest.max_update_time, '%Y-%m') as statisDate,
|
||||
<include refid="dataTypeChooseFilter"/>
|
||||
from ( SELECT p.site_id, p.device_id,p.date_month,MAX(p.data_update_time) as max_update_time
|
||||
FROM ems_pcs_data p
|
||||
<include refid="statisCommonFilter"/>
|
||||
GROUP BY p.site_id,p.device_id,p.date_month
|
||||
) latest inner join ems_pcs_data t ON latest.site_id = t.site_id
|
||||
AND latest.device_id = t.device_id
|
||||
AND latest.max_update_time = t.data_update_time
|
||||
and latest.date_month = t.date_month
|
||||
group by statisDate
|
||||
<include refid="groupChooseFilter"/>
|
||||
order by statisDate desc
|
||||
</select>
|
||||
|
||||
<select id="getPcsActivePowerByHour" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.PcsStatisListVo">
|
||||
select latest.dateHour as statisDate,
|
||||
<include refid="dataTypeChooseFilter"/>
|
||||
from ( SELECT p.site_id, p.device_id,DATE_FORMAT(p.data_update_time, '%H')+1 AS dateHour,MAX(p.data_update_time) as max_update_time
|
||||
FROM ems_pcs_data p
|
||||
<include refid="statisCommonFilter"/>
|
||||
GROUP BY p.site_id,p.device_id,dateHour
|
||||
) latest inner join ems_pcs_data t ON latest.site_id = t.site_id
|
||||
AND latest.device_id = t.device_id
|
||||
AND latest.max_update_time = t.data_update_time
|
||||
group by statisDate
|
||||
<include refid="groupChooseFilter"/>
|
||||
order by statisDate desc
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user