2018-07-13 19:39:04 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.nis.web.dao.dashboard.TrafficHttpStatisticDao">
|
|
|
|
|
<resultMap id="BaseResultMap" type="com.nis.domain.restful.dashboard.TrafficHttpStatistic">
|
|
|
|
|
<id column="stat_id" jdbcType="INTEGER" property="statId" />
|
2018-09-21 20:56:01 +08:00
|
|
|
<result column="link_num" jdbcType="INTEGER" property="linkNum" />
|
2018-07-13 19:39:04 +08:00
|
|
|
<result column="web_id" jdbcType="INTEGER" property="webId" />
|
2018-10-11 09:23:09 +08:00
|
|
|
<result column="c2s_pkt_num" jdbcType="BIGINT" property="c2sPktNum" />
|
|
|
|
|
<result column="s2c_pkt_num" jdbcType="BIGINT" property="s2cPktNum" />
|
|
|
|
|
<result column="c2s_byte_len" jdbcType="BIGINT" property="c2sByteLen" />
|
|
|
|
|
<result column="s2c_byte_len" jdbcType="BIGINT" property="s2cByteLen" />
|
2018-07-13 19:39:04 +08:00
|
|
|
<result column="stat_time" jdbcType="TIMESTAMP" property="statTime" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
<sql id="Base_Column_List">
|
|
|
|
|
stat_id, web_type, web_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
|
|
|
|
|
stat_time
|
|
|
|
|
</sql>
|
2018-10-26 14:41:27 +08:00
|
|
|
<!-- 获取最近时间并且有效 -->
|
|
|
|
|
<select id="getMaxStatTime" resultType="com.nis.domain.restful.dashboard.TrafficHttpStatistic">
|
2018-11-15 17:27:35 +08:00
|
|
|
SELECT MAX(stat_time) statTime FROM traffic_http_statistic WHERE web_id != 0
|
2018-10-26 14:41:27 +08:00
|
|
|
</select>
|
2018-09-21 20:56:01 +08:00
|
|
|
<!-- 根据服务网站将域名分类 网站列表-->
<select id="getDomainByWebsiteList" resultType="com.nis.domain.restful.dashboard.TrafficHttpStatistic">
|
2018-12-01 14:10:59 +08:00
|
|
|
SELECT SUM(c2s_byte_len+s2c_byte_len) count, IFNULL( website_service_id, 268435455 ) websiteServiceId
|
2018-11-15 17:27:35 +08:00
|
|
|
FROM TRAFFIC_HTTP_STATISTIC t
|
|
|
|
|
LEFT JOIN ui_website_domain_topic u ON t.web_id = u.id
|
2018-10-22 17:37:25 +08:00
|
|
|
where t.web_id!=0
|
2018-10-26 14:41:27 +08:00
|
|
|
and t.stat_time = #{statTime}
|
2018-10-22 17:37:25 +08:00
|
|
|
GROUP BY u.website_service_id ORDER BY count desc limit 0,10
|
2018-09-21 20:56:01 +08:00
|
|
|
</select>
|
|
|
|
|
<!-- 根据主题将域名分类 主题列表 最近五分钟top10-->
<select id="getDomainByTopicList" resultType="java.util.HashMap">
|
2018-12-01 14:10:59 +08:00
|
|
|
SELECT SUM(c2s_byte_len+s2c_byte_len) count, IFNULL( topic_id, 268435455 ) topicId
|
2018-11-15 17:27:35 +08:00
|
|
|
FROM TRAFFIC_HTTP_STATISTIC t
|
|
|
|
|
LEFT JOIN ui_website_domain_topic u ON t.web_id = u.id
|
2018-10-22 17:37:25 +08:00
|
|
|
where t.web_id!=0
|
2018-10-26 14:41:27 +08:00
|
|
|
and t.stat_time =#{statTime}
|
2018-10-22 17:37:25 +08:00
|
|
|
GROUP BY u.topic_id ORDER BY count desc limit 0,10
|
2018-09-21 20:56:01 +08:00
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
<!--获取上个时间段该网站站域名流量的数据量 -->
|
2018-12-01 16:00:15 +08:00
|
|
|
<select id="preWebsiteListCount" resultType="java.lang.Long">
|
2018-12-01 14:10:59 +08:00
|
|
|
SELECT SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_http_statistic t
|
2018-11-15 17:27:35 +08:00
|
|
|
LEFT JOIN ui_website_domain_topic u ON t.web_id = u.id
|
2018-09-25 11:03:14 +08:00
|
|
|
WHERE u.website_service_id=#{websiteServiceId}
|
2018-10-26 14:41:27 +08:00
|
|
|
and stat_time = DATE_SUB(#{statTime},INTERVAL 5 MINUTE)
|
2018-09-21 20:56:01 +08:00
|
|
|
</select>
|
|
|
|
|
|
2018-07-13 19:39:04 +08:00
|
|
|
<!--获取网站列表列表 -->
|
2018-09-21 20:56:01 +08:00
|
|
|
<!-- <select id="websiteList" resultMap="BaseResultMap">
|
2018-11-15 17:27:35 +08:00
|
|
|
SELECT web_id webId, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count FROM traffic_http_statistic
|
|
|
|
|
WHERE web_id !=0 and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM traffic_http_statistic),INTERVAL 5 MINUTE)
|
2018-07-13 19:39:04 +08:00
|
|
|
GROUP BY web_id ORDER BY count DESC limit 0,10
|
2018-09-21 20:56:01 +08:00
|
|
|
</select> -->
|
|
|
|
|
<!-- 根据网站分组获取子域名 -->
|
2018-10-26 14:41:27 +08:00
|
|
|
<select id="getDomainByWebsiteServiceId" resultType="java.util.HashMap">
|
2018-12-01 14:10:59 +08:00
|
|
|
SELECT web_id webId,SUM(c2s_byte_len+s2c_byte_len) count
|
2018-11-15 17:27:35 +08:00
|
|
|
FROM traffic_http_statistic t
|
|
|
|
|
LEFT JOIN ui_website_domain_topic u ON t.web_id=u.id
|
2018-09-21 20:56:01 +08:00
|
|
|
where u.website_service_id=#{websiteServiceId}
|
2018-10-26 14:41:27 +08:00
|
|
|
and t.stat_time =#{statTime}
|
2018-10-22 17:37:25 +08:00
|
|
|
GROUP BY t.web_id ORDER BY count desc limit 0,10
|
2018-07-13 19:39:04 +08:00
|
|
|
</select>
|
2018-09-21 20:56:01 +08:00
|
|
|
<!-- 根据主题分组获取子域名 -->
|
|
|
|
|
<select id="getDomainByTopicId" resultType="java.util.HashMap">
|
2018-12-01 14:10:59 +08:00
|
|
|
SELECT web_id webId,SUM(c2s_byte_len+s2c_byte_len) count
|
2018-11-15 17:27:35 +08:00
|
|
|
FROM traffic_http_statistic t
|
|
|
|
|
LEFT JOIN ui_website_domain_topic u ON t.web_id=u.id
|
2018-09-21 20:56:01 +08:00
|
|
|
where u.topic_id=#{topicId}
|
2018-10-26 14:41:27 +08:00
|
|
|
and t.stat_time = #{statTime}
|
2018-10-22 17:37:25 +08:00
|
|
|
GROUP BY t.web_id ORDER BY count desc limit 0,10
|
2018-07-23 17:44:18 +08:00
|
|
|
</select>
|
2018-09-21 20:56:01 +08:00
|
|
|
|
2018-07-23 17:44:18 +08:00
|
|
|
<!-- 指定网站下的TOP10之外为others -->
|
2018-09-21 20:56:01 +08:00
|
|
|
<select id="websiteDomainOthers" resultType="java.util.HashMap">
|
2018-12-01 14:10:59 +08:00
|
|
|
SELECT SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_http_statistic t
|
2018-11-15 17:27:35 +08:00
|
|
|
LEFT JOIN ui_website_domain_topic u ON t.web_id=u.id
|
2018-09-21 20:56:01 +08:00
|
|
|
where u.website_service_id=#{websiteServiceId}
|
2018-09-26 19:14:46 +08:00
|
|
|
and t.web_id!=0
|
2018-09-21 20:56:01 +08:00
|
|
|
<if test="webIdList!=null and webIdList.size()>0">
|
|
|
|
|
and t.web_id not in
|
|
|
|
|
<foreach collection="webIdList" item="singleType" index="index" open="(" close=")" separator=",">
|
2018-07-23 17:44:18 +08:00
|
|
|
#{singleType}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
2018-10-26 14:41:27 +08:00
|
|
|
and stat_time =#{statTime}
|
2018-07-13 19:39:04 +08:00
|
|
|
</select>
|
|
|
|
|
</mapper>
|