修改优化流量统计时间段及排序问题
This commit is contained in:
@@ -19,15 +19,15 @@
|
||||
<select id="getTotalReportList" resultType="java.util.HashMap">
|
||||
SELECT SUM(reject_num) rejectNum,SUM(monitor_num) monitorNum,SUM(c2s_pkt_num) c2sPktNum,SUM(s2c_pkt_num) s2cPktNum,SUM(c2s_byte_len) c2sByteLen,SUM(s2c_byte_len) s2cByteLen,SUM(new_uni_conn_num) newUniConnNum,SUM(live_conn_num) liveConnNum,
|
||||
SUM(drop_conn_num) dropConnNum,SUM(loop_conn_num) loopConnNum FROM galaxy.ntc_total_report
|
||||
where report_time >= DATE_SUB((SELECT MAX(report_time) FROM galaxy.ntc_total_report),INTERVAL 5 MINUTE)
|
||||
where report_time = (SELECT MAX(report_time) FROM galaxy.ntc_total_report)
|
||||
</select>
|
||||
<select id="getNetFlowPortInfoNew" resultType="java.util.HashMap">
|
||||
SELECT SUM(INOCTETS) inoctets ,SUM(OUTOCTETS) outoctets FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO
|
||||
where RECV_TIME >= DATE_SUB((SELECT MAX(RECV_TIME) FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO),INTERVAL 4 MINUTE)
|
||||
where RECV_TIME = (SELECT MAX(RECV_TIME) FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO)
|
||||
</select>
|
||||
<!-- 获取上个时间段的数据 -->
|
||||
<select id="getNetFlowPortInfoOld" resultType="java.util.HashMap">
|
||||
SELECT SUM(INOCTETS) inoctets ,SUM(OUTOCTETS) outoctets FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO
|
||||
where RECV_TIME between DATE_SUB((SELECT MAX(RECV_TIME) FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO),INTERVAL 9 MINUTE)
|
||||
and DATE_SUB((SELECT MAX(RECV_TIME) FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO),INTERVAL 4 MINUTE)
|
||||
where RECV_TIME = DATE_SUB((SELECT MAX(RECV_TIME) FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO),INTERVAL 5 MINUTE)
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -18,7 +18,7 @@
|
||||
<select id="appChart" resultType="java.util.HashMap">
|
||||
SELECT app_type appType, SUM(link_num) count, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen
|
||||
FROM galaxy.traffic_app_statistic
|
||||
WHERE app_type !=0 and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_app_statistic WHERE app_type != 0),INTERVAL 5 MINUTE)
|
||||
WHERE app_type !=0 and stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_app_statistic WHERE app_type != 0)
|
||||
GROUP BY app_type order by count desc limit 0,10
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -19,17 +19,17 @@
|
||||
<select id="getDomainByWebsiteList" resultType="com.nis.domain.restful.dashboard.TrafficHttpStatistic">
|
||||
SELECT SUM(link_num) count, IFNULL( website_service_id, 268435455 ) websiteServiceId ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen
|
||||
FROM galaxy.TRAFFIC_HTTP_STATISTIC t
|
||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id = u.id
|
||||
and t.web_id!=0
|
||||
and t.stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic WHERE web_id != 0),INTERVAL 5 MINUTE)
|
||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id = u.id
|
||||
where t.web_id!=0
|
||||
and t.stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic WHERE web_id != 0)
|
||||
GROUP BY u.website_service_id ORDER BY count desc limit 0,10
|
||||
</select>
|
||||
<!-- 根据主题将域名分类 主题列表 最近五分钟top10-->
|
||||
<select id="getDomainByTopicList" resultType="java.util.HashMap">
|
||||
SELECT SUM(link_num) count, IFNULL( topic_id, 268435455 ) topicId ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen
|
||||
FROM galaxy.TRAFFIC_HTTP_STATISTIC t
|
||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id = u.id
|
||||
and t.web_id!=0
|
||||
FROM galaxy.TRAFFIC_HTTP_STATISTIC t
|
||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id = u.id
|
||||
where t.web_id!=0
|
||||
and t.stat_time =(SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic WHERE web_id != 0)
|
||||
GROUP BY u.topic_id ORDER BY count desc limit 0,10
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<!--获取上个时间段该网站站域名流量的数据量 -->
|
||||
<select id="preWebsiteListCount" resultType="java.lang.Integer">
|
||||
SELECT SUM(link_num) count FROM galaxy.traffic_http_statistic t
|
||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id = u.id
|
||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id = u.id
|
||||
WHERE u.website_service_id=#{websiteServiceId}
|
||||
and stat_time = DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic WHERE web_id != 0),INTERVAL 5 MINUTE)
|
||||
</select>
|
||||
@@ -52,8 +52,8 @@
|
||||
<select id="getDomainByWebsiteServiceId" parameterType="java.lang.Integer" resultType="java.util.HashMap">
|
||||
SELECT web_id webId,SUM(link_num) count,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen
|
||||
FROM galaxy.traffic_http_statistic t
|
||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id=u.id
|
||||
where u.website_service_id=#{websiteServiceId}
|
||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id=u.id
|
||||
where u.website_service_id=#{websiteServiceId}
|
||||
and t.stat_time =(SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic WHERE web_id != 0)
|
||||
GROUP BY t.web_id ORDER BY count desc limit 0,10
|
||||
</select>
|
||||
@@ -61,8 +61,8 @@
|
||||
<select id="getDomainByTopicId" resultType="java.util.HashMap">
|
||||
SELECT web_id webId,SUM(link_num) count,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen
|
||||
FROM galaxy.traffic_http_statistic t
|
||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id=u.id
|
||||
where u.topic_id=#{topicId}
|
||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id=u.id
|
||||
where u.topic_id=#{topicId}
|
||||
and t.stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic WHERE web_id != 0)
|
||||
GROUP BY t.web_id ORDER BY count desc limit 0,10
|
||||
</select>
|
||||
@@ -77,6 +77,6 @@
|
||||
and t.web_id not in
|
||||
<foreach collection="webIdList" item="singleType" index="index" open="(" close=")" separator=",">
|
||||
#{singleType}
|
||||
</foreach>
|
||||
</foreach>
|
||||
</if>
|
||||
and stat_time =(SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic WHERE web_id != 0)
|
||||
@@ -47,7 +47,7 @@
|
||||
<!-- IP流量统计五分钟-->
|
||||
<select id="ipActiveChart" resultType="java.util.LinkedHashMap">
|
||||
SELECT ip_addr ipAddr, SUM(link_num) linkNum ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ip_active_statistic
|
||||
WHERE stat_time > DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ip_active_statistic),INTERVAL 5 MINUTE)
|
||||
WHERE stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_ip_active_statistic)
|
||||
GROUP BY ip_addr ORDER BY linkNum DESC limit 0,10
|
||||
</select>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
<select id="getPortActiveList" resultMap="BaseResultMap">
|
||||
SELECT port ,SUM(sum) sum from galaxy.traffic_port_active_statistic
|
||||
WHERE stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_port_active_statistic),INTERVAL 5 MINUTE)
|
||||
GROUP BY port order by sum limit 0,10
|
||||
WHERE stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_port_active_statistic)
|
||||
GROUP BY port order by sum desc limit 0,10
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -17,6 +17,6 @@
|
||||
</sql>
|
||||
<select id="protocolChart" resultType="java.util.HashMap">
|
||||
SELECT proto_type protoType, SUM(link_num) count, ( SUM(c2s_pkt_num) + SUM(s2c_pkt_num)) pktNum, ( SUM(c2s_byte_len) + SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_protocol_statistic WHERE proto_type != 0
|
||||
AND stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_protocol_statistic WHERE proto_type != 0), INTERVAL 5 MINUTE) GROUP BY proto_type ORDER BY count DESC LIMIT 0, 10
|
||||
AND stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_protocol_statistic WHERE proto_type != 0) GROUP BY proto_type ORDER BY count DESC LIMIT 0, 10
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -19,19 +19,19 @@
|
||||
<!--获取操作系统列表TOP10 -->
|
||||
<select id="systemList" resultMap="BaseResultMap">
|
||||
SELECT os_type osType, SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
|
||||
WHERE os_type !=0 and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE os_type != 0),INTERVAL 5 MINUTE)
|
||||
WHERE os_type !=0 and stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE os_type != 0)
|
||||
GROUP BY os_type ORDER BY count DESC limit 0,10
|
||||
</select>
|
||||
<!--获取上个时间段操作系统的数据量 -->
|
||||
<select id="preSystemListCount" resultType="java.lang.Integer">
|
||||
SELECT SUM(link_num) count FROM galaxy.traffic_ua_statistic
|
||||
WHERE os_type !=0 and os_type=#{osType}
|
||||
and stat_time between DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE os_type != 0),INTERVAL 10 MINUTE) and DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 5 MINUTE)
|
||||
and stat_time = DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE os_type != 0),INTERVAL 5 MINUTE)
|
||||
</select>
|
||||
<!-- 根据操作系统获取浏览器分类 -->
|
||||
<select id="getBrowserBySystem" parameterType="java.lang.Integer" resultType="java.util.HashMap">
|
||||
SELECT bs_type bsType, SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
|
||||
WHERE bs_type !=0 and os_type=#{osType} and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE bs_type != 0),INTERVAL 5 MINUTE)
|
||||
WHERE bs_type !=0 and os_type=#{osType} and stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE bs_type != 0)
|
||||
GROUP BY bs_type ORDER BY count DESC limit 0,10
|
||||
</select>
|
||||
<!--浏览器TOP10后所有为others -->
|
||||
@@ -44,25 +44,25 @@
|
||||
#{singleType}
|
||||
</foreach>
|
||||
</if>
|
||||
and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE bs_type != 0),INTERVAL 5 MINUTE)
|
||||
and stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE bs_type != 0)
|
||||
</select>
|
||||
|
||||
<!--获取浏览器列表TOP10 -->
|
||||
<select id="browserList" resultMap="BaseResultMap">
|
||||
SELECT bs_type bsType, SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
|
||||
WHERE bs_type !=0 and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 5 MINUTE)
|
||||
WHERE bs_type !=0 and stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE bs_type !=0)
|
||||
GROUP BY bs_type ORDER BY count DESC limit 0,10
|
||||
</select>
|
||||
<!--获取上个时间段浏览器的数据量 -->
|
||||
<select id="preBrowserListCount" resultType="java.lang.Integer">
|
||||
SELECT SUM(link_num) count FROM galaxy.traffic_ua_statistic
|
||||
WHERE bs_type !=0 and bs_type=#{bsType}
|
||||
and stat_time between DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 10 MINUTE) and DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 5 MINUTE)
|
||||
and stat_time = DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE bs_type !=0),INTERVAL 5 MINUTE)
|
||||
</select>
|
||||
<!-- 根据浏览器获取操作系统分类 -->
|
||||
<select id="getSystemBybrowser" parameterType="java.lang.Integer" resultType="java.util.HashMap">
|
||||
SELECT os_type osType, SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
|
||||
WHERE os_type !=0 and bs_type=#{bsType} and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 5 MINUTE)
|
||||
WHERE os_type !=0 and bs_type=#{bsType} and stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE os_type !=0)
|
||||
GROUP BY os_type ORDER BY count DESC limit 0,10
|
||||
</select>
|
||||
<!--操作系统TOP10后所有为others -->
|
||||
@@ -75,6 +75,6 @@
|
||||
#{singleType}
|
||||
</foreach>
|
||||
</if>
|
||||
and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic),INTERVAL 5 MINUTE)
|
||||
and stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE os_type !=0)
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user