修改优化流量统计时间段及排序问题

This commit is contained in:
zhanghongqing
2018-10-22 17:37:25 +08:00
parent 4fb18a6f31
commit 4ae042c2f2
7 changed files with 29 additions and 29 deletions

View File

@@ -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)