This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
k18-ntcs-web-argus-service/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.xml

146 lines
5.1 KiB
XML
Raw Normal View History

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" />
<result column="link_num" jdbcType="INTEGER" property="linkNum" />
<result column="web_id" jdbcType="INTEGER" property="webId" />
<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" />
<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>
<!-- 获取最近时间并且有效 -->
<select id="getMaxStatTime"
resultType="com.nis.domain.restful.dashboard.TrafficHttpStatistic">
SELECT stat_time statTime FROM traffic_http_statistic order
by stat_time
desc limit 1
</select>
<!-- 根据服务网站将域名分类 网站列表 -->
<select id="getDomainByWebsiteList"
resultType="java.util.HashMap">
SELECT
IFNULL(
website_service_id,
268435455
) websiteServiceId,
id
FROM
ui_website_domain_topic t group by website_service_id,id
</select>
<!-- 根据主题将域名分类 主题列表 最近五分钟top10 -->
<select id="getDomainByTopicList" resultType="java.util.HashMap">
SELECT
IFNULL(topic_id, 268435455) topicId,
id
FROM
ui_website_domain_topic u
GROUP BY
u.topic_id,
id
</select>
<!--获取上个时间段该网站站域名流量的数据量 -->
<select id="getHttpStatisticNoLinkAndPkt" resultType="java.util.HashMap">
select web_id webId,
SUM(c2s_byte_len + s2c_byte_len) byteCount from
traffic_http_statistic t where
<![CDATA[ stat_time>= #{statTime} and stat_time< #{endTime} group by t.web_id ]]>
</select>
<select id="getTrafficHttpStatistic" resultType="java.util.HashMap">
select web_id webId,
SUM(c2s_byte_len + s2c_byte_len) byteCount,
sum(c2s_pkt_num + s2c_pkt_num) pktCount,
link_num linkNum from
traffic_http_statistic t where
<![CDATA[ stat_time>= #{statTime} and stat_time< #{endTime} group by t.web_id,link_num]]>
</select>
<!--获取网站列表列表 -->
<!-- <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
FROM traffic_http_statistic WHERE web_id !=0 and stat_time >= DATE_SUB((SELECT
MAX(stat_time) FROM traffic_http_statistic),INTERVAL 5 MINUTE) GROUP BY web_id
ORDER BY count DESC limit 0,10 </select> -->
<!-- 根据网站分组获取子域名 -->
<select id="getDomainByWebsiteServiceId"
resultType="java.util.HashMap">
SELECT
web_id webId,
SUM(c2s_byte_len + s2c_byte_len) count
FROM
traffic_http_statistic t where
<![CDATA[ stat_time>= #{statTime} and stat_time< #{endTime} ]]>
<if test="webIdList!=null and webIdList.size()>0">
and web_id in
<foreach collection="webIdList" item="singleType"
index="index" open="(" close=")" separator=",">
#{singleType}
</foreach>
</if>
group by t.web_id
</select>
<select id="getIdByWebSiteId"
resultType="java.lang.String">
SELECT
distinct id FROM ui_website_domain_topic where website_service_id= #{websiteId}
</select>
<!-- 指定网站下的TOP10之外为others -->
<select id="websiteDomainOthers" resultType="java.util.HashMap">
SELECT SUM(c2s_byte_len+s2c_byte_len) count FROM
traffic_http_statistic t
where
<![CDATA[ stat_time>= #{statTime} and stat_time< #{endTime} ]]>
<if test="webIdList!=null and webIdList.size()>0">
and t.web_id not in
<foreach collection="webIdList" item="singleType"
index="index" open="(" close=")" separator=",">
#{singleType}
</foreach>
</if>
</select>
2018-12-18 04:59:07 +08:00
<!--获取域名 -->
<select id="getTrafficHttpDomain" resultType="java.util.HashMap">
select web_id webId, unique_num uniqueNum,entrance_id entranceId,SUM(c2s_byte_len + s2c_byte_len) byteCount,
sum(c2s_pkt_num + s2c_pkt_num) pktCount from traffic_http_focus_statistic t where
<![CDATA[ stat_time>= #{beginDate} and stat_time< #{endDate}]]>
<if test="domain!=null">
and web_id=#{domain}
</if>
<if test="entranceId!=null">
and entrance_id=#{entranceId}
</if>
2018-12-18 06:52:52 +08:00
group by web_id order by unique_num
2018-12-18 04:59:07 +08:00
</select>
<select id="getDomainTrans" resultType="com.nis.domain.restful.dashboard.TrafficHttpFocusStatistic">
select stat_time time, unique_num count from traffic_http_focus_statistic t where
<![CDATA[ stat_time>= #{beginDate} and stat_time< #{endDate}]]>
and web_id=#{domain}
<if test="entranceId!=null">
and entrance_id=#{entranceId}
</if>
order by stat_time
</select>
2018-07-13 19:39:04 +08:00
</mapper>