70 lines
3.7 KiB
XML
70 lines
3.7 KiB
XML
<?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.TrafficAppStatisticDao">
|
|
<resultMap id="BaseResultMap" type="com.nis.domain.restful.dashboard.TrafficAppStatistic">
|
|
<id column="stat_id" jdbcType="INTEGER" property="statId" />
|
|
<result column="app_type" jdbcType="INTEGER" property="appType" />
|
|
<result column="entrance_id" jdbcType="INTEGER" property="entranceId" />
|
|
<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, app_type, entrance_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.TrafficAppStatistic">
|
|
SELECT stat_time statTime FROM traffic_app_statistic order by stat_time desc limit 1
|
|
</select>
|
|
|
|
<select id="appChart" resultType="java.util.HashMap">
|
|
SELECT app_type appType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_app_statistic
|
|
WHERE stat_time > DATE_SUB(#{statTime},INTERVAL 1 hour)
|
|
GROUP BY app_type order by count desc limit 0,10
|
|
</select>
|
|
|
|
<!-- 获取app统计详情 -->
|
|
<select id="getAppList" resultType="java.util.HashMap">
|
|
SELECT IFNULL(c.app_name,p.app_type) appName,p.app_type appType,p.link_num linkNum, p.packets packets, p.GByte GByte FROM (
|
|
SELECT app_type,SUM(link_num) AS link_num,SUM(c2s_pkt_num+s2c_pkt_num) AS packets,
|
|
((SUM(c2s_byte_len+s2c_byte_len)*8)/300/1024/1024/1024) AS GByte
|
|
FROM traffic_app_statistic WHERE
|
|
<![CDATA[ stat_time>= #{beginTime} and stat_time< #{endTime}]]>
|
|
<if test="appType!=null">
|
|
and app_type in
|
|
<foreach collection="appType" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
GROUP BY app_type ) p
|
|
LEFT JOIN ui_code_app_dic c ON p.app_type=c.view_code ORDER BY p.GByte DESC
|
|
</select>
|
|
<!-- App 趋势详情 -->
|
|
<select id="getAppTrend" parameterType="com.nis.domain.restful.dashboard.TrafficAppFocusStatistic" resultType="com.nis.domain.restful.dashboard.TrafficAppFocusStatistic">
|
|
select stat_time time, max(unique_sip_num) sipNum,max(unique_dip_num) dipNum from traffic_app_focus_statistic t where
|
|
<![CDATA[ stat_time>= toDateTime(#{searchStartTime}) and stat_time< toDateTime(#{searchEndTime})
|
|
and app_id=toInt64(#{searchAppId}) ]]>
|
|
<if test="searchEntranceId">
|
|
<![CDATA[and entrance_id=toInt64(#{searchEntranceId}) ]]>
|
|
</if>
|
|
|
|
group by stat_time
|
|
order by stat_time
|
|
</select>
|
|
<!-- App通联关系Top100 -->
|
|
<select id="appConnRecordTop100" parameterType="com.nis.domain.restful.dashboard.AppConnRecordStatistic" resultType="com.nis.domain.restful.dashboard.AppConnRecordStatistic">
|
|
select found_time,s_ip ipAddr, sum(c2s_byte_num + s2c_byte_num) byteNum, sum(c2s_pkt_num + s2c_pkt_num) pktNum, count(found_time) logNum
|
|
from tbs_ods_ntc_conn_record_log t where
|
|
<![CDATA[ found_time>= toDateTime(#{searchStartTime}) and found_time< toDateTime(#{searchEndTime})
|
|
and app_id=toInt64(#{searchAppId}) ]]>
|
|
<if test="searchEntranceId">
|
|
<![CDATA[and entrance_id=toInt64(#{searchEntranceId}) ]]>
|
|
</if>
|
|
|
|
group by found_time,s_ip
|
|
order by logNum limit 100
|
|
</select>
|
|
</mapper> |