|
@@ -92,10 +92,12 @@
|
|
|
|
|
|
<select id="getTodayAllLampLogData" resultType="LampInfoLogNewDTO">
|
|
|
SELECT
|
|
|
- SUM( l.used_energy_tonight ) AS usedEnergyTonight,
|
|
|
- SUM( l.work_time_tonight ) AS workTimeTonight
|
|
|
+ SUM(IF(DATE(l.updatetime) = CURDATE(), l.used_energy_tonight, 0)) AS usedEnergyTonight,
|
|
|
+ SUM(IF(DATE(l.updatetime) = CURDATE(), l.day_ele_save, 0)) AS dayEleSave,
|
|
|
+ SUM(l.used_energy_total) AS usedEnergyTotal,
|
|
|
+ SUM(l.total_ele_save) AS totalEleSave
|
|
|
FROM
|
|
|
- lamp_info_log_new l
|
|
|
+ lamp_info_log_new l
|
|
|
LEFT JOIN lampinfo l1 ON l.lampid = l1.id
|
|
|
LEFT JOIN section s ON s.id = l1.sectionid
|
|
|
LEFT JOIN global_location a ON a.id = s.pid
|
|
@@ -120,7 +122,40 @@
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- AND DATE(l.updatetime) = CURDATE()
|
|
|
</select>
|
|
|
|
|
|
+<!-- <select id="getTodayAllLampLogData" resultType="LampInfoLogNewDTO">-->
|
|
|
+<!-- SELECT-->
|
|
|
+<!-- SUM(l.used_energy_tonight) AS usedEnergyTonight,-->
|
|
|
+<!-- SUM(l.day_ele_save) AS dayEleSave,-->
|
|
|
+<!-- SUM(l.used_energy_total) AS usedEnergyTotal,-->
|
|
|
+<!-- SUM(l.total_ele_save) AS totalEleSave-->
|
|
|
+<!-- FROM-->
|
|
|
+<!-- lamp_info_log_new l-->
|
|
|
+<!-- LEFT JOIN lampinfo l1 ON l.lampid = l1.id-->
|
|
|
+<!-- LEFT JOIN section s ON s.id = l1.sectionid-->
|
|
|
+<!-- LEFT JOIN global_location a ON a.id = s.pid-->
|
|
|
+<!-- LEFT JOIN global_location b ON b.id = a.pid-->
|
|
|
+<!-- LEFT JOIN global_location c ON c.id = b.pid-->
|
|
|
+<!-- WHERE 1=1-->
|
|
|
+<!-- <if test="sectionId != null and sectionId != 0">-->
|
|
|
+<!-- and s.id = #{sectionId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="areaId != null and areaId != 0">-->
|
|
|
+<!-- and a.id = #{areaId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="cityId != null and cityId != 0">-->
|
|
|
+<!-- and b.id = #{cityId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="provinceId != null and provinceId != 0">-->
|
|
|
+<!-- and d.id = #{provinceId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="sectionList != null and !sectionList.isEmpty()">-->
|
|
|
+<!-- and l1.sectionid in-->
|
|
|
+<!-- <foreach collection="sectionList" item="item" open="(" separator="," close=")">-->
|
|
|
+<!-- #{item}-->
|
|
|
+<!-- </foreach>-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- </select>-->
|
|
|
+
|
|
|
</mapper>
|