流量统计 网站统计sql修改
This commit is contained in:
@@ -13,7 +13,7 @@ public interface TrafficHttpStatisticDao {
|
|||||||
|
|
||||||
//获取域名分类之后属于的网站
|
//获取域名分类之后属于的网站
|
||||||
List<TrafficHttpStatistic> getDomainByWebsiteList();
|
List<TrafficHttpStatistic> getDomainByWebsiteList();
|
||||||
Integer preWebsiteListCount(@Param("webId") Integer webId);
|
Integer preWebsiteListCount(@Param("websiteServiceId") Integer websiteServiceId);
|
||||||
List<Map> getDomainByWebsiteServiceId(@Param("websiteServiceId") Integer websiteServiceId);
|
List<Map> getDomainByWebsiteServiceId(@Param("websiteServiceId") Integer websiteServiceId);
|
||||||
Map websiteDomainOthers(@Param("webIdList") List webIdList,@Param("websiteServiceId") Integer websiteServiceId);
|
Map websiteDomainOthers(@Param("webIdList") List webIdList,@Param("websiteServiceId") Integer websiteServiceId);
|
||||||
|
|
||||||
|
|||||||
@@ -19,28 +19,30 @@
|
|||||||
<select id="getDomainByWebsiteList" resultType="com.nis.domain.restful.dashboard.TrafficHttpStatistic">
|
<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
|
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
|
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
|
||||||
and stat_time between DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 10 MINUTE) and DATE_SUB(NOW(),INTERVAL 5 MINUTE)
|
<!-- and stat_time between DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 10 MINUTE) and DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE) -->
|
||||||
|
and t.stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
|
||||||
GROUP BY u.website_service_id ORDER BY count limit 0,10
|
GROUP BY u.website_service_id ORDER BY count limit 0,10
|
||||||
</select>
|
</select>
|
||||||
<!-- 根据主题将域名分类 主题列表 最近五分钟top10-->
|
<!-- 根据主题将域名分类 主题列表 最近五分钟top10-->
|
||||||
<select id="getDomainByTopicList" resultType="java.util.HashMap">
|
<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
|
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
|
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
|
||||||
and t.stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
|
and t.stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
|
||||||
GROUP BY u.topic_id ORDER BY count limit 0,10
|
GROUP BY u.topic_id ORDER BY count limit 0,10
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
<!--获取上个时间段该网站站域名流量的数据量 -->
|
<!--获取上个时间段该网站站域名流量的数据量 -->
|
||||||
<select id="preWebsiteListCount" resultType="java.lang.Integer">
|
<select id="preWebsiteListCount" resultType="java.lang.Integer">
|
||||||
SELECT SUM(link_num) count FROM galaxy.traffic_http_statistic
|
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
|
||||||
WHERE u.website_service_id=#{websiteServiceId}
|
WHERE u.website_service_id=#{websiteServiceId}
|
||||||
and stat_time between DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 10 MINUTE) and DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
|
and stat_time between DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 10 MINUTE) and DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--获取网站列表列表 -->
|
<!--获取网站列表列表 -->
|
||||||
<!-- <select id="websiteList" resultMap="BaseResultMap">
|
<!-- <select id="websiteList" resultMap="BaseResultMap">
|
||||||
SELECT web_id webId, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_http_statistic
|
SELECT web_id webId, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_http_statistic
|
||||||
WHERE web_id !=0 and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
|
WHERE web_id !=0 and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
|
||||||
GROUP BY web_id ORDER BY count DESC limit 0,10
|
GROUP BY web_id ORDER BY count DESC limit 0,10
|
||||||
@@ -50,7 +52,7 @@
|
|||||||
SELECT web_id webId,link_num count,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen
|
SELECT web_id webId,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
|
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}
|
where u.website_service_id=#{websiteServiceId}
|
||||||
and t.stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
|
and t.stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
|
||||||
GROUP BY t.web_id ORDER BY count limit 0,10
|
GROUP BY t.web_id ORDER BY count limit 0,10
|
||||||
</select>
|
</select>
|
||||||
@@ -59,7 +61,7 @@
|
|||||||
SELECT web_id webId,link_num count,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen
|
SELECT web_id webId,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
|
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.topic_id=#{topicId}
|
where u.topic_id=#{topicId}
|
||||||
and t.stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
|
and t.stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
|
||||||
GROUP BY t.web_id ORDER BY count limit 0,10
|
GROUP BY t.web_id ORDER BY count limit 0,10
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<select id="ipActiveChart" resultType="java.util.LinkedHashMap">
|
<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
|
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 >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ip_active_statistic),INTERVAL 5 MINUTE)
|
||||||
GROUP BY ip_addr ORDER BY link_num DESC limit 0,10
|
GROUP BY ip_addr ORDER BY linkNum DESC limit 0,10
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user