From 6f28997aa8d9f62e0c54838490a473041f709742 Mon Sep 17 00:00:00 2001 From: zmc <zmc_li@foxmail.com> Date: 星期四, 02 十一月 2023 11:42:32 +0800 Subject: [PATCH] 修改了数据排名清单sql查询语句 --- src/main/resources/mapper/FugitiveDustMapper.xml | 55 +++++++++++++++++++++++++++++++++---------------------- 1 files changed, 33 insertions(+), 22 deletions(-) diff --git a/src/main/resources/mapper/FugitiveDustMapper.xml b/src/main/resources/mapper/FugitiveDustMapper.xml index de696eb..f387e49 100644 --- a/src/main/resources/mapper/FugitiveDustMapper.xml +++ b/src/main/resources/mapper/FugitiveDustMapper.xml @@ -63,41 +63,52 @@ </if> <if test="beginTime != null and endTime != null"> - and a.Lst between #{beginTime} and #{endTime} + and a.Lst between #{beginTime} and #{endTime} and a.type = #{type} </if> </where> </select> + +<!-- <!– 鏍规嵁绔欑偣鍚嶅瓧鍜屾椂娈佃繘琛岀粺璁″垎鏋�–>--> +<!-- <select id="analysisByTime" resultType="com.flightfeather.monitor.pojo.AnalysisDustData">--> +<!-- select c.name,d.*--> +<!-- from ja_t_dust_site_info as c join--> +<!-- (--> +<!-- select--> +<!-- mn_code as mn_code,--> +<!-- DATE(lst) as lst,--> +<!-- ROUND(AVG(dust_value),3) as day_avg,--> +<!-- min(dust_value) as min,--> +<!-- max(dust_value) as max,--> +<!-- CONCAT(ROUND(COUNT(*)/96*100, 2), '%') as day_online,--> +<!-- CONCAT(ROUND(SUM(CASE WHEN dust_value >0 THEN 1 ELSE 0 END)/96 *100, 2), '%') as day_valid,--> +<!-- CONCAT(ROUND(SUM(CASE WHEN dust_value >= 1 THEN 1 ELSE 0 END)/96*100,2),'%') as day_exceeding--> +<!-- from ja_t_dust_site_data_info--> +<!-- <where>--> +<!--<!– <if test="siteName !=null and siteName != ''">–>--> +<!--<!– b.name = #{siteName}–>--> +<!--<!– </if>–>--> + +<!-- <if test="beginTime != null and endTime != null">--> +<!-- lst between #{beginTime} and #{endTime}--> +<!-- </if>--> + +<!-- </where>--> +<!-- GROUP BY mn_code,DATE(lst)--> +<!-- order by lst asc ) as d on c.mn_code = d.mn_code--> +<!-- </select>--> <!-- 鏍规嵁绔欑偣鍚嶅瓧鍜屾椂娈佃繘琛岀粺璁″垎鏋�--> <select id="analysisByTime" resultType="com.flightfeather.monitor.pojo.AnalysisDustData"> select c.name,d.* - from ja_t_dust_site_info as c join - ( - select - mn_code as mn_code, - DATE(lst) as lst, - ROUND(AVG(dust_value),3) as day_avg, - min(dust_value) as min, - max(dust_value) as max, - CONCAT(ROUND(COUNT(*)/96*100, 2), '%') as day_online, - CONCAT(ROUND(SUM(CASE WHEN dust_value >0 THEN 1 ELSE 0 END)/96 *100, 2), '%') as day_valid, - CONCAT(ROUND(SUM(CASE WHEN dust_value >= 1 THEN 1 ELSE 0 END)/96*100,2),'%') as day_exceeding - from ja_t_dust_site_data_info + from ja_t_dust_site_info as c join dust_statistics_value as d on c.mn_code = d.mn_code <where> -<!-- <if test="siteName !=null and siteName != ''">--> -<!-- b.name = #{siteName}--> -<!-- </if>--> - <if test="beginTime != null and endTime != null"> - lst between #{beginTime} and #{endTime} + d.lst between #{beginTime} and #{endTime} and d.type = 'day' </if> - </where> - GROUP BY mn_code,DATE(lst) - order by lst asc ) as d on c.mn_code = d.mn_code + order by c.name asc </select> - <!--鏉′欢鏌ヨ寮傚父鏁版嵁 鍔犱笂浜嗗璁′俊鎭�--> -- Gitblit v1.9.3