| | |
| | | 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, |
| | | ROUND(COUNT(*)/96, 4) as day_online, |
| | | ROUND(SUM(CASE WHEN dust_value >0 THEN 1 ELSE 0 END)/96, 4) as day_valid, |
| | | ROUND(SUM(CASE WHEN dust_value >= 1 THEN 1 ELSE 0 END)/96, 4) as day_exceeding, |
| | | 'day' as type |
| | | from ja_t_dust_site_data_info |
| | | where lst between #{beginTime} and #{endTime} |
| | |
| | | ROUND(AVG(dust_value), 3) AS month_avg, |
| | | MIN(dust_value) AS min, |
| | | MAX(dust_value) AS max, |
| | | CONCAT(ROUND(COUNT(*) / #{count} * 100, 2), '%') AS month_online, |
| | | CONCAT(ROUND(SUM(CASE WHEN flag = 'N' OR flag = 'A' THEN 1 ELSE 0 END) / #{count} * 100, 2), '%') AS month_valid, |
| | | CONCAT(ROUND(SUM(CASE WHEN dust_value >= 1 THEN 1 ELSE 0 END) / #{count} * 100, 2), '%') AS month_exceeding, |
| | | ROUND(COUNT(*) / #{count}, 4) AS month_online, |
| | | ROUND(SUM(CASE WHEN flag = 'N' OR flag = 'A' THEN 1 ELSE 0 END) / #{count}, 4) AS month_valid, |
| | | ROUND(SUM(CASE WHEN dust_value >= 1 THEN 1 ELSE 0 END) / #{count}, 4) AS month_exceeding, |
| | | 'month' as type |
| | | FROM ja_t_dust_site_data_info |
| | | WHERE lst BETWEEN #{beginTime} and #{endTime} |
| | | GROUP BY mn_code, DATE_FORMAT(lst, '%Y-%m-01') |
| | | ) as a |
| | | </insert> |
| | | |
| | | <!-- 根据站点名字和时段进行统计分析--> |
| | | <select id="selectByOrder" resultType="com.flightfeather.monitor.pojo.AnalysisDustData"> |
| | | select c.name,d.* |
| | | from dust_statistics_value as d |
| | | left join ja_t_dust_site_info as c on c.mn_code = d.mn_code |
| | | <where> |
| | | <if test="siteName != null and siteName != ''"> |
| | | and c.name = #{siteName} |
| | | </if> |
| | | <if test="beginTime != null and endTime != null"> |
| | | and d.lst between #{beginTime} and #{endTime} and d.type = 'day' |
| | | </if> |
| | | </where> |
| | | <if test="orderProp == 'lst'"> |
| | | order by d.lst |
| | | </if> |
| | | <if test="orderProp == 'day_avg'"> |
| | | order by d.day_avg |
| | | </if> |
| | | <if test="orderProp == 'min'"> |
| | | order by d.min |
| | | </if> |
| | | <if test="orderProp == 'max'"> |
| | | order by d.max |
| | | </if> |
| | | <if test="orderProp == 'day_online'"> |
| | | order by d.day_online |
| | | </if> |
| | | <if test="orderProp == 'day_valid'"> |
| | | order by d.day_valid |
| | | </if> |
| | | <if test="orderProp == 'day_exceeding'"> |
| | | order by d.day_exceeding |
| | | </if> |
| | | <if test="orderProp != null and asc"> |
| | | asc |
| | | </if> |
| | | <if test="orderProp != null and !asc"> |
| | | desc |
| | | </if> |
| | | </select> |
| | | </mapper> |