From 1eecc1f678668ba11b15198be4f0057cf886e7f6 Mon Sep 17 00:00:00 2001 From: zmc <zmc_li@foxmail.com> Date: 星期二, 29 八月 2023 08:48:40 +0800 Subject: [PATCH] 扬尘监测后端代码 --- src/main/resources/com/job/zsc/mapper/FugitiveDustMapper.xml | 78 ++++++++++++++++++++++++++++----------- 1 files changed, 56 insertions(+), 22 deletions(-) diff --git a/src/main/resources/com/job/zsc/mapper/FugitiveDustMapper.xml b/src/main/resources/com/job/zsc/mapper/FugitiveDustMapper.xml index 1d320aa..97d37c9 100644 --- a/src/main/resources/com/job/zsc/mapper/FugitiveDustMapper.xml +++ b/src/main/resources/com/job/zsc/mapper/FugitiveDustMapper.xml @@ -43,28 +43,6 @@ </select> -<!-- 鏍规嵁绔欑偣鍚嶅瓧鍜屾椂娈佃繘琛岀粺璁″垎鏋�--> -<!-- <select id="analysisByTime" resultType="com.job.zsc.pojo.AnalysisDustData">--> -<!-- select--> -<!-- a.mn_code as mn_code,--> -<!-- DATE(a.lst) as lst,--> -<!-- ROUND(AVG(a.dust_value),3) as day_avg,--> -<!-- CONCAT(ROUND(COUNT(*)/96*100, 2), '%') as day_online,--> -<!-- CONCAT(ROUND(SUM(CASE WHEN a.dust_value >0 THEN 1 ELSE 0 END)/COUNT(*) *100, 2), '%') as day_valid,--> -<!-- CONCAT(ROUND(SUM(CASE WHEN a.dust_value >= 1 THEN 1 ELSE 0 END)/96*100,2),'%') as day_exceeding--> -<!-- from ja_t_dust_site_data_info as a join ja_t_dust_site_info as b on a.mn_code = b.mn_code--> -<!-- <where>--> -<!-- <if test="siteName !=null and siteName != ''">--> -<!-- b.name = #{siteName}--> -<!-- </if>--> - -<!-- <if test="beginTime != null and endTime != null">--> -<!-- and a.lst between #{beginTime} and #{endTime}--> -<!-- </if>--> -<!-- </where>--> -<!-- group by a.mn_code,DATE(a.lst)--> -<!-- order by lst asc--> -<!-- </select>--> <!-- 鏍规嵁绔欑偣鍚嶅瓧鍜屾椂娈佃繘琛岀粺璁″垎鏋�--> <select id="analysisByTime" resultType="com.job.zsc.pojo.AnalysisDustData"> select c.name,d.* @@ -73,6 +51,8 @@ a.mn_code as mn_code, DATE(a.lst) as lst, ROUND(AVG(a.dust_value),3) as day_avg, + min(a.dust_value) as min, + max(a.dust_value) as max, CONCAT(ROUND(COUNT(*)/96*100, 2), '%') as day_online, CONCAT(ROUND(SUM(CASE WHEN a.dust_value >0 THEN 1 ELSE 0 END)/COUNT(*) *100, 2), '%') as day_valid, CONCAT(ROUND(SUM(CASE WHEN a.dust_value >= 1 THEN 1 ELSE 0 END)/96*100,2),'%') as day_exceeding @@ -89,4 +69,58 @@ GROUP BY a.mn_code,DATE(a.lst) order by lst asc ) as d on c.mn_code = d.mn_code </select> + + <!--鏉′欢鏌ヨ寮傚父鏁版嵁--> + <select id="getExceptionData" resultType="com.job.zsc.pojo.DustExceptionData"> + select b.name,b.typename,b.address,b.duty_company,a.* + from dust_exception_data as a join ja_t_dust_site_info as b on a.mn_code = b.mn_code + <where> + <if test="siteName !=null and siteName != ''"> + b.name = #{siteName} + </if> + + <if test="exceptionType != null and exceptionType != '' "> + and a.exception_type in + <foreach item="item" collection="exceptionType" separator="," open="(" close=")"> + #{item} + </foreach> + </if> + + <if test="beginTime != null and endTime != null"> + and (a.begin_time between #{beginTime} and #{endTime} or a.end_time between #{beginTime} and #{endTime}) + </if> + </where> + </select> + + + <!-- 鏍规嵁鏌愭鏃堕棿鍐呮煇涓紓甯哥被鍨嬫煡璇㈠搴旂殑搴楅摵鍚嶇О鍜岃澶囩紪鍙�--> + <select id="getExceptionSitenameAndCode" resultType="com.job.zsc.pojo.DustExceptionData"> + select DISTINCT b.name,a.mn_code + from dust_exception_data as a join ja_t_dust_site_info as b on a.mn_code = b.mn_code + <where> + <if test="exceptionType !=null and exceptionType != ''"> + a.exception_type = #{exceptionType} + </if> + + <if test="beginTime != null and endTime != null"> + and (a.begin_time between #{beginTime} and #{endTime} or a.end_time between #{beginTime} and #{endTime}) + </if> + </where> + </select> + +<!-- 鏉′欢鏌ヨ鍘嗗彶鏁版嵁--> + <select id="conditonQueryHistoryData" resultType="com.job.zsc.pojo.DustSiteData"> + select a.*,b.name,b.duty_Company + from ja_t_dust_site_data_info as a join ja_t_dust_site_info as b on a.mn_code = b.mn_code + <where> + <if test="siteName !=null and siteName != ''"> + b.name = #{siteName} + </if> + + <if test="beginTime != null and endTime != null"> + and a.lst between #{beginTime} and #{endTime} + </if> + </where> + order by a.lst asc + </select> </mapper> \ No newline at end of file -- Gitblit v1.9.3