This commit is contained in:
xy
2024-04-28 13:17:41 +08:00
parent b299dfd845
commit 6cb222359f
3 changed files with 47 additions and 30 deletions

View File

@@ -105,12 +105,35 @@
</trim>
</insert>
<select id="selectBySubstationPage" resultType="com.njcn.device.pq.pojo.dto.PollutionGridDiagramDTO">
SELECT
<!-- SELECT-->
<!-- substation_id as id,-->
<!-- IF(`pollution_type`=#{typeMapId.I,javaType=string},value,3.14159) as `data`,-->
<!-- IF(`pollution_type`=#{typeMapId.V,javaType=string},value,3.14159) as `dataV`-->
<!-- FROM-->
<!-- r_stat_pollution_substation_m-->
<!-- <where>-->
<!-- <if test="ids != null and ids.size > 0">-->
<!-- AND substation_id IN-->
<!-- <foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="startTime != null and startTime !=''">-->
<!-- AND data_date >= #{startTime}-->
<!-- </if>-->
<!-- <if test="endTime != null and endTime != ''">-->
<!-- AND data_date &lt;= #{endTime}-->
<!-- </if>-->
<!-- </where>-->
<!-- GROUP BY-->
<!-- substation_id-->
<!-- ORDER BY `data` DESC,dataV DESC-->
select
substation_id as id,
IF(`pollution_type`=#{typeMapId.I,javaType=string},value,3.14159) as `data`,
IF(`pollution_type`=#{typeMapId.V,javaType=string},value,3.14159) as `dataV`
FROM
r_stat_pollution_substation_m
SUM(case when pollution_type = #{typeMapId.I,javaType=string} then value else null end) as data ,
SUM(case when pollution_type = #{typeMapId.V,javaType=string} then value else null end) as dataV
from
r_stat_pollution_substation_m
<where>
<if test="ids != null and ids.size > 0">
AND substation_id IN
@@ -125,10 +148,7 @@
AND data_date &lt;= #{endTime}
</if>
</where>
GROUP BY
group by
substation_id
ORDER BY `data` DESC,dataV DESC
</select>
</mapper>