问题优化
This commit is contained in:
@ -295,21 +295,19 @@
|
||||
</delete>
|
||||
|
||||
<select id="getPcsDataBySiteId" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
||||
select CONCAT(t.date_month,'/',t.date_day) as ammeterDate,
|
||||
select latest.dateDay as ammeterDate,
|
||||
sum(t.daily_ac_charge_energy) as chargedCap,
|
||||
sum(t.daily_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
|
||||
SELECT p.site_id, p.device_id,DATE_FORMAT(p.data_update_time, '%m-%d') as dateDay, MAX(p.data_update_time) AS max_update_time
|
||||
FROM ems_pcs_data p
|
||||
where p.site_id = #{siteId} and p.create_time >= CURDATE() - INTERVAL #{limitTime} DAY
|
||||
GROUP BY p.site_id,p.device_id,p.date_month,p.date_day
|
||||
GROUP BY p.site_id,p.device_id,dateDay
|
||||
) 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 ammeterDate
|
||||
order by ammeterDate desc;
|
||||
order by ammeterDate desc
|
||||
</select>
|
||||
|
||||
<select id="getPcsTotalChargeData" resultType="map">
|
||||
@ -400,18 +398,16 @@
|
||||
</sql>
|
||||
|
||||
<select id="getPcsDataByDay" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
||||
select DATE(latest.max_update_time) as ammeterDate,
|
||||
select latest.dateDay 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 ( SELECT p.site_id, p.device_id,DATE(p.data_update_time) as dateDay, MAX(p.data_update_time) AS max_update_time
|
||||
FROM ems_pcs_data p
|
||||
<include refid="commonFilter"/>
|
||||
GROUP BY p.site_id,p.device_id,p.date_month,p.date_day
|
||||
GROUP BY p.site_id,p.device_id,dateDay
|
||||
) 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 ammeterDate
|
||||
order by ammeterDate desc
|
||||
</select>
|
||||
@ -494,17 +490,15 @@
|
||||
|
||||
|
||||
<select id="getPcsActivePowerByDay" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.PcsStatisListVo">
|
||||
select DATE(latest.max_update_time) as statisDate,
|
||||
select latest.dateDay 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 ( SELECT p.site_id, p.device_id,DATE(p.data_update_time ) AS dateDay,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
|
||||
GROUP BY p.site_id,p.device_id,dateDay
|
||||
) 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
|
||||
order by statisDate desc
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user