@ -3,23 +3,35 @@
<mapper namespace= "org.springblade.lims.mapper.LargeScreenMapper" >
<select id= "getTotalElectricity" resultType= "org.springblade.lims.entry.LargeScreenVO" >
SELECT
sum( ifnull( a.single_ electricity, 0 ) ) total_electricity
sum( electricity ) total_electricity
FROM
t_instrument_data a
LEFT JOIN t_instrument b ON a.imei = b.CODE
t_enterprise_power
<where >
<if test= "currentYear !=null and currentYear != ''" >
and a. current_year = #{currentYear}
and current_year = #{currentYear}
</if>
<if test= "currentMonth !=null and currentMonth != ''" >
and a.current_month = #{currentMonth}
and current_month = #{currentMonth}
</if>
<if test= "yesterday !=null and yesterday != ''" >
and current_day = #{yesterday}
</if>
<if test= "manufacturerBrand !=null and manufacturerBrand != ''" >
and manufacturer_brand = #{manufacturerBrand}
</if>
</where>
</select>
<select id= "getTotalElectricityToday" resultType= "org.springblade.lims.entry.LargeScreenVO" >
SELECT
sum( ifnull( a.single_electricity, 0 ) ) total_electricity
FROM
t_instrument_data a
LEFT JOIN t_instrument b ON a.imei = b.CODE
<where >
<if test= "today !=null and today != ''" >
and a.current_day = #{today}
</if>
<if test= "yesterday !=null and yesterday != ''" >
and a.current_day = #{yesterday}
</if>
<if test= "manufacturerBrand !=null and manufacturerBrand != ''" >
and b.manufacturer_brand = #{manufacturerBrand}
</if>
@ -28,21 +40,18 @@
<select id= "getDayElectricity" resultType= "org.springblade.lims.entry.LargeScreenVO" >
SELECT
sum( a.single_ electricity ) total_electricity,
a. current_day AS `date`
electricity total_electricity,
current_day AS `date`
FROM
t_instrument_data a
LEFT JOIN t_instrument b ON a.imei = b.CODE
t_enterprise_power
<where >
<if test= "currentMonth !=null and currentMonth != ''" >
and a. current_month = #{currentMonth}
and current_month = #{currentMonth}
</if>
<if test= "manufacturerBrand !=null and manufacturerBrand != ''" >
and b. manufacturer_brand = #{manufacturerBrand}
and manufacturer_brand = #{manufacturerBrand}
</if>
</where>
GROUP BY
a.current_day
</select>
<select id= "getHourElectricity" resultType= "org.springblade.lims.entry.LargeScreenVO" >
@ -354,9 +363,9 @@
<select id= "getTotalCarbonEmissions" resultType= "org.springblade.lims.entry.LargeScreenVO" >
SELECT
ROUND( sum( IFNULL( a.single_electricity, 0 )) * 0.997/1000, 2 ) totalCarbonEmissions
sum(carbon ) totalCarbonEmissions
FROM
t_instrument_data a
t_enterprise_power a
<where >
<if test= "currentYear !=null and currentYear != ''" >
AND a.current_year = #{currentYear}
@ -367,33 +376,31 @@
<select id= "getEnterprisePower" resultType= "org.springblade.lims.entry.LargeScreenVO" >
SELECT
a.manufacturer_brand,
sum( ifnull(b.single_electricity,0) ) `sum`,
round(sum( ifnull(b.single_electricity,0) ) * 0.997/1000,2 ) totalCarbonEmissions
sum(a.electricity ) `sum`,
sum(a.carbon ) totalCarbonEmissions
FROM
t_instrument a
LEFT JOIN t_instrument_data b ON a.`code` = b.imei
t_enterprise_power a
<where >
<if test= "currentYear !=null and currentYear != ''" >
and b .current_year = #{currentYear}
and a .current_year = #{currentYear}
</if>
<if test= "currentMonth !=null and currentMonth != ''" >
and b .current_month = #{currentMonth}
and a .current_month = #{currentMonth}
</if>
<if test= "today !=null and today != ''" >
and b .current_day = #{today}
and a .current_day = #{today}
</if>
</where>
GROUP BY
a.manufacturer_brand order by sum( ifnull(b.single_electricity,0) ) desc
group by a.manufacturer_brand
order by sum(a.electricity ) desc
</select>
<select id= "getSixMonthElectricity" resultType= "org.springblade.lims.entry.LargeScreenVO" >
SELECT
current_month,
sum(
ifnull( single_electricity, 0 )) AS `sum`
sum(electricity) AS `sum`
FROM
t_instrument_data
t_enterprise_power
<where >
<if test= "monthList !=null" >
AND current_month in
@ -409,10 +416,9 @@
<select id= "getMonthCarbon" resultType= "org.springblade.lims.entry.LargeScreenVO" >
SELECT
current_month,
ROUND(sum(
ifnull( single_electricity, 0 )) * 0.997/1000,2) AS totalCarbonEmissions
sum(carbon) AS totalCarbonEmissions
FROM
t_instrument_data
t_enterprise_power
<where >
<if test= "monthList !=null" >
AND current_month in