|
@@ -118,28 +118,19 @@
|
|
|
from ems_data_electricity_day as e
|
|
|
where e.day=#{day} and e.equipmentid in (301156947525633)
|
|
|
union
|
|
|
- select 290016857227265 as energyitemid,'其它用电' as equipmentname, '能耗分项' as type,
|
|
|
- (
|
|
|
- select ifnull(sum(electricityvalue),0)
|
|
|
- from ems_data_electricity_day
|
|
|
- where equipmentid in (301156882513921) and day=#{day}
|
|
|
- ) -
|
|
|
- (
|
|
|
- select ifnull(sum(electricityvalue),0)
|
|
|
- from ems_data_electricity_day
|
|
|
- where equipmentid in (301156930748417,301156962205697) and day=#{day}
|
|
|
- ) -
|
|
|
- (
|
|
|
- select ifnull(sum(electricityvalue),0)
|
|
|
- from ems_data_electricity_day
|
|
|
- where equipmentid in (301156947525633) and day=#{day}
|
|
|
- ) as howManyValue
|
|
|
+ select 290016838352897 as energyitemid,'照明用电' as equipmentname, '能耗分项' as type,ifnull(sum(e.electricityvalue),0) as howManyValue
|
|
|
+ from ems_data_electricity_day as e
|
|
|
+ where e.day=#{day} and e.equipmentid in (301154594521089)
|
|
|
+ union
|
|
|
+ select 290016857227265 as energyitemid,'其它用电' as equipmentname, '能耗分项' as type,ifnull(sum(e.electricityvalue),0) as howManyValue
|
|
|
+ from ems_data_electricity_day as e
|
|
|
+ where e.day=#{day} and e.equipmentid in (300984435802113)
|
|
|
</select>
|
|
|
<select id="selectItemByEquipidAndDay" resultType="org.jeecg.modules.emsStatistics.entity.EmsStatistics">
|
|
|
select t.energyitemid as equipmentid,i.energyitemname as equipmentname, '能耗分项' as type,ifnull(sum(e.electricityvalue),0) as howManyValue
|
|
|
from ems_data_electricity_day as e,tpm_tag as t,base_energy_item as i,base_energy_type as y
|
|
|
- where e.tagid=t.id t.energyitemid=i.energyitemid and e.day=#{day}
|
|
|
- and i.energytypeid=y.energytypeid and y.name='电'
|
|
|
+ where e.tagid=t.id and t.energyitemid=i.id and e.day=#{day}
|
|
|
+ and i.energytypeid=y.id and y.name='电'
|
|
|
and e.equipmentid in (
|
|
|
select equipmentid
|
|
|
from tpm_equipment_status
|
|
@@ -182,4 +173,26 @@
|
|
|
order by e.equipmentid asc
|
|
|
</select>
|
|
|
|
|
|
+ <!--依据多个设备的ID获取某天的实际用能、计划用能-->
|
|
|
+ <select id="selectEnergyByDay" resultType="org.jeecg.modules.emsStatistics.entity.EmsStatistics">
|
|
|
+ select '实际用能' as type,ifnull(sum(electricityvalue),0) as howManyValue
|
|
|
+ from ems_data_electricity_day
|
|
|
+ where day=#{day}
|
|
|
+ and equipmentid in (
|
|
|
+ select equipmentid
|
|
|
+ from tpm_equipment_status
|
|
|
+ )
|
|
|
+ and equipmentid in
|
|
|
+ <foreach collection="ids" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ union
|
|
|
+ select '计划用能' as type,sum(planvalue) as howManyValue
|
|
|
+ from base_energy_plan
|
|
|
+ where day=#{day} and equipmentid in
|
|
|
+ <foreach collection="ids" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|