1、流量统计:将时间查询条件用stat_id查改回用stat_time查;

2、解决流量统计最后一个点不统计数据的问题
This commit is contained in:
zhangdongxu
2018-12-29 18:57:21 +08:00
parent 8a4d831615
commit 989594579a
4 changed files with 42 additions and 64 deletions

View File

@@ -69,18 +69,13 @@
<select id="getBandwidthTransIPVx" resultMap="BandwidthResultMap">
select addr_type,trans_type,entrance_id,IFNULL((SUM(c2s_byte_len+s2c_byte_len)*8)/300/1024/1024/1024,0) gbps,IFNULL(SUM(c2s_pkt_num+s2c_pkt_num)/300,0) pps,IFNULL(SUM(link_num),0) linkNum, stat_time from traffic_trans_statistic
WHERE
<![CDATA[stat_id BETWEEN (select stat_id from traffic_trans_statistic where stat_time >= #{beginDate} order by stat_id limit 1)
and
(select stat_id from traffic_trans_statistic where stat_time < #{endDate} order by stat_id desc limit 1)
]]>
<![CDATA[ stat_time >= #{beginDate} and stat_time < #{endDate} ]]>
and addr_type in (4,6)
group by addr_type,stat_time ,entrance_id order by stat_time
</select>
<select id="getBandwidthTransProtocol" resultMap="BandwidthResultMap">
select addr_type,trans_type,entrance_id,IFNULL((SUM(c2s_byte_len+s2c_byte_len)*8)/300/1024/1024/1024,0) gbps,IFNULL(SUM(c2s_pkt_num+s2c_pkt_num)/300,0) pps,IFNULL(SUM(link_num),0) linkNum, stat_time from traffic_trans_statistic
WHERE stat_id BETWEEN
<![CDATA[(select stat_id from traffic_trans_statistic where stat_time >= #{beginDate} order by stat_id limit 1)
and (select stat_id from traffic_trans_statistic where stat_time < #{endDate} order by stat_id desc limit 1) ]]>
WHERE <![CDATA[stat_time >= #{beginDate} and stat_time < #{endDate} ]]>
and trans_type in (6,17) group by trans_type,stat_time ,entrance_id order by stat_time
</select>

View File

@@ -34,11 +34,8 @@
GROUP BY ip_addr ORDER BY linkNum DESC limit 0,10
</select>-->
<select id="ipActiveChart" resultType="java.util.LinkedHashMap">
SELECT ip_addr ipAddr,SUM(c2s_byte_len + s2c_byte_len) linkNum FROM traffic_ip_active_statistic WHERE
stat_id BETWEEN
(select stat_id from traffic_ip_active_statistic where<![CDATA[ stat_time >= #{beginDate} order by stat_id limit 1)]]>
AND
(select stat_id from traffic_ip_active_statistic where<![CDATA[ stat_time < #{endDate} order by stat_id desc limit 1)]]>
SELECT ip_addr ipAddr,SUM(c2s_byte_len + s2c_byte_len) linkNum FROM traffic_ip_active_statistic WHERE
<![CDATA[ stat_time >= #{beginDate} AND stat_time < #{endDate}]]>
GROUP BY ip_addr ORDER BY linkNum DESC LIMIT 0,10
</select>