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/TrafficAppStatisticDao.xml

35 lines
2.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.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" />
2018-07-13 19:39:04 +08:00
<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>
2018-10-26 14:41:27 +08:00
<!-- 查询最近时间 -->
<select id="getMaxStatTime" resultType="com.nis.domain.restful.dashboard.TrafficAppStatistic">
2018-11-15 17:27:35 +08:00
SELECT MAX(stat_time) statTime FROM traffic_app_statistic WHERE app_type != 0
2018-10-26 14:41:27 +08:00
</select>
2018-07-13 19:39:04 +08:00
<select id="appChart" resultType="java.util.HashMap">
SELECT app_type appType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_app_statistic
2018-10-26 14:41:27 +08:00
WHERE app_type !=0 and stat_time = #{statTime}
GROUP BY app_type order by count desc limit 0,10
2018-07-13 19:39:04 +08:00
</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)/1024/1024/1024) AS GByte
FROM traffic_app_statistic WHERE stat_time=#{statTime} 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>
2018-07-13 19:39:04 +08:00
</mapper>