|
@@ -114,7 +114,7 @@
|
|
and b.id = #{cityId}
|
|
and b.id = #{cityId}
|
|
</if>
|
|
</if>
|
|
<if test="provinceId != null and provinceId != 0">
|
|
<if test="provinceId != null and provinceId != 0">
|
|
- and d.id = #{provinceId}
|
|
|
|
|
|
+ and c.id = #{provinceId}
|
|
</if>
|
|
</if>
|
|
<if test="sectionList != null and !sectionList.isEmpty()">
|
|
<if test="sectionList != null and !sectionList.isEmpty()">
|
|
and l1.sectionid in
|
|
and l1.sectionid in
|
|
@@ -124,38 +124,50 @@
|
|
</if>
|
|
</if>
|
|
</select>
|
|
</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>-->
|
|
|
|
|
|
+ <!-- 查询各省份的省电量 -->
|
|
|
|
+ <select id="getLampLogProvinceList" resultType="LampInfoLogNewDTO">
|
|
|
|
+ SELECT
|
|
|
|
+ SUM(l.total_ele_save) AS totalEleSaveDouble,
|
|
|
|
+ c.id AS provinceId
|
|
|
|
+ <choose>
|
|
|
|
+ <when test="version == 2">
|
|
|
|
+ ,c.ru_name AS provinceName
|
|
|
|
+ </when>
|
|
|
|
+ <when test="version == 1">
|
|
|
|
+ ,c.english_name AS provinceName
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+ ,c.chinese_name AS provinceName
|
|
|
|
+ </otherwise>
|
|
|
|
+ </choose>
|
|
|
|
+ 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 c.id IS NOT NULL
|
|
|
|
+ <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 c.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>
|
|
|
|
+ GROUP BY provinceId
|
|
|
|
+ ORDER BY totalEleSaveDouble DESC
|
|
|
|
+ </select>
|
|
|
|
|
|
</mapper>
|
|
</mapper>
|