设置无数据时traffic的数据为0

This commit is contained in:
zhanghongqing
2019-01-18 19:49:47 +08:00
parent 574ef84309
commit 6848876a97

View File

@@ -32,7 +32,7 @@
</select>
<!-- 根据最近时间条获取带宽,进出口流量 -->
<select id="getNetFlowPortInfoNew" resultType="java.util.HashMap">
SELECT SUM(total_traffic.inoctets) AS inoctets , SUM(total_traffic.outoctets) AS outoctets FROM (
SELECT COALESCE(SUM(total_traffic.inoctets),0) AS inoctets , COALESCE(SUM(total_traffic.outoctets),0) AS outoctets FROM (
SELECT sum(case direction when 1 then c2s_byte_len+s2c_byte_len else 0 end) inoctets ,sum(case direction when 0 then c2s_byte_len+s2c_byte_len else 0 end) outoctets FROM traffic_trans_statistic
where stat_time = (SELECT stat_time FROM traffic_trans_statistic WHERE entrance_id=1 and stat_time > DATE_SUB(now(), INTERVAL 15 MINUTE) ORDER BY stat_time DESC LIMIT 0,1) and entrance_id=1
UNION ALL