|
@@ -219,5 +219,119 @@
|
|
|
where yearmonth >= #{beginTime} and yearmonth <= #{endTime} and equipmentid = #{equipmentid}
|
|
|
</select>
|
|
|
|
|
|
+ <!--依据个设备的ID和年、周获取能耗分项-依据配电室的电表来计算-->
|
|
|
+ <select id="selectItemByEquipidAndYearweekTotal" resultType="org.jeecg.modules.emsStatistics.entity.EmsStatistics">
|
|
|
+ select 290016788021249 as energyitemid,'动力用电' as equipmentname, '能耗分项' as type,ifnull(sum(e.electricityvalue),0) as howManyValue
|
|
|
+ from ems_data_electricity_day as e
|
|
|
+ where e.year=#{year} and e.week=#{week} and e.equipmentid in (301156930748417,301156962205697)
|
|
|
+ union
|
|
|
+ select 290016823672833 as energyitemid,'空调用电' as equipmentname, '能耗分项' as type,sum(e.electricityvalue) as howManyValue
|
|
|
+ from ems_data_electricity_day as e
|
|
|
+ where e.year=#{year} and e.week=#{week} and e.equipmentid in (301156947525633)
|
|
|
+ union
|
|
|
+ select 290016838352897 as energyitemid,'照明用电' as equipmentname, '能耗分项' as type,ifnull(sum(e.electricityvalue),0) as howManyValue
|
|
|
+ from ems_data_electricity_day as e
|
|
|
+ where e.year=#{year} and e.week=#{week} 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.year=#{year} and e.week=#{week} and e.equipmentid in (300984435802113)
|
|
|
+ </select>
|
|
|
+ <!--依据个设备的ID和年、周获取能耗分项-->
|
|
|
+ <select id="selectItemByEquipidAndYearweek" 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 and t.energyitemid=i.id and e.year=#{year} and e.week=#{week}
|
|
|
+ and i.energytypeid=y.id and y.name='电'
|
|
|
+ and e.equipmentid in (
|
|
|
+ select equipmentid
|
|
|
+ from tpm_equipment_status
|
|
|
+ )
|
|
|
+ and e.equipmentid in
|
|
|
+ <foreach collection="ids" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ group by t.energyitemid
|
|
|
+ order by t.energyitemid asc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--依据个设备的ID和年、月获取能耗分项-依据配电室的电表来计算-->
|
|
|
+ <select id="selectItemByEquipidAndYearmonthTotal" resultType="org.jeecg.modules.emsStatistics.entity.EmsStatistics">
|
|
|
+ select 290016788021249 as energyitemid,'动力用电' as equipmentname, '能耗分项' as type,ifnull(sum(e.electricityvalue),0) as howManyValue
|
|
|
+ from ems_data_electricity_day as e
|
|
|
+ where e.year=#{year} and e.month=#{month} and e.equipmentid in (301156930748417,301156962205697)
|
|
|
+ union
|
|
|
+ select 290016823672833 as energyitemid,'空调用电' as equipmentname, '能耗分项' as type,ifnull(sum(e.electricityvalue),0) as howManyValue
|
|
|
+ from ems_data_electricity_day as e
|
|
|
+ where e.year=#{year} and e.month=#{month} and e.equipmentid in (301156947525633)
|
|
|
+ union
|
|
|
+ select 290016838352897 as energyitemid,'照明用电' as equipmentname, '能耗分项' as type,ifnull(sum(e.electricityvalue),0) as howManyValue
|
|
|
+ from ems_data_electricity_day as e
|
|
|
+ where e.year=#{year} and e.month=#{month} 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.year=#{year} and e.month=#{month} and e.equipmentid in (300984435802113)
|
|
|
+ </select>
|
|
|
+ <!--依据个设备的ID和年、月获取能耗分项-->
|
|
|
+ <select id="selectItemByEquipidAndYearmonth" 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 and t.energyitemid=i.id and e.year=#{year} and e.month=#{month}
|
|
|
+ and i.energytypeid=y.id and y.name='电'
|
|
|
+ and e.equipmentid in (
|
|
|
+ select equipmentid
|
|
|
+ from tpm_equipment_status
|
|
|
+ )
|
|
|
+ and e.equipmentid in
|
|
|
+ <foreach collection="ids" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ group by t.energyitemid
|
|
|
+ order by t.energyitemid asc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--依据个设备的ID和日期、开始结束时间获取能耗分项-->
|
|
|
+ <select id="selectItemByEquipidAndDaytimeTotal" resultType="org.jeecg.modules.emsStatistics.entity.EmsStatistics">
|
|
|
+ select 290016788021249 as energyitemid,'动力用电' as equipmentname, '能耗分项' as type,ifnull(sum(e.tagvalue2),0) as howManyValue
|
|
|
+ from ems_data_electricity as e
|
|
|
+ where e.day=#{day} and e.time >= #{beginTime} and e.time <= #{endTime}
|
|
|
+ and e.equipmentid in (301156930748417,301156962205697)
|
|
|
+ union
|
|
|
+ select 290016823672833 as energyitemid,'空调用电' as equipmentname, '能耗分项' as type,ifnull(sum(e.tagvalue2),0) as howManyValue
|
|
|
+ from ems_data_electricity as e
|
|
|
+ where e.day=#{day} and e.time >= #{beginTime} and e.time <= #{endTime}
|
|
|
+ and e.equipmentid in (301156947525633)
|
|
|
+ union
|
|
|
+ select 290016838352897 as energyitemid,'照明用电' as equipmentname, '能耗分项' as type,ifnull(sum(e.tagvalue2),0) as howManyValue
|
|
|
+ from ems_data_electricity as e
|
|
|
+ where e.day=#{day} and e.time >= #{beginTime} and e.time <= #{endTime}
|
|
|
+ and e.equipmentid in (301154594521089)
|
|
|
+ union
|
|
|
+ select 290016857227265 as energyitemid,'其它用电' as equipmentname, '能耗分项' as type,ifnull(sum(e.tagvalue2),0) as howManyValue
|
|
|
+ from ems_data_electricity as e
|
|
|
+ where e.day=#{day} and e.time >= #{beginTime} and e.time <= #{endTime}
|
|
|
+ and e.equipmentid in (300984435802113)
|
|
|
+ </select>
|
|
|
+ <!--依据个设备的ID和日期、开始结束时间获取能耗分项-->
|
|
|
+ <select id="selectItemByEquipidAndDaytime" resultType="org.jeecg.modules.emsStatistics.entity.EmsStatistics">
|
|
|
+ select t.energyitemid as equipmentid,i.energyitemname as equipmentname, '能耗分项' as type,ifnull(sum(e.tagvalue2),0) as howManyValue
|
|
|
+ from ems_data_electricity as e,tpm_tag as t,base_energy_item as i,base_energy_type as y
|
|
|
+ where e.tagid=t.id and t.energyitemid=i.id and e.day=#{day}
|
|
|
+ and e.time >= #{beginTime} and e.time <= #{endTime}
|
|
|
+ and i.energytypeid=y.id and y.name='电'
|
|
|
+ and e.equipmentid in (
|
|
|
+ select equipmentid
|
|
|
+ from tpm_equipment_status
|
|
|
+ )
|
|
|
+ and e.equipmentid in
|
|
|
+ <foreach collection="ids" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ group by t.energyitemid
|
|
|
+ order by t.energyitemid asc
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
|
|
|
</mapper>
|