流量统计活跃端口增加上个时间段统计
This commit is contained in:
@@ -3,10 +3,13 @@ package com.nis.web.dao.dashboard;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.restful.dashboard.TrafficPortActiveStatistic;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
@MyBatisDao
|
||||
public interface TrafficPortActiveStatisticDao {
|
||||
|
||||
List<TrafficPortActiveStatistic> getPortActiveList();
|
||||
TrafficPortActiveStatistic getPortActiveOld(@Param("port")Integer port);
|
||||
}
|
||||
@@ -7,10 +7,16 @@
|
||||
<result column="sum" jdbcType="BIGINT" property="sum" />
|
||||
<result column="stat_time" jdbcType="TIMESTAMP" property="statTime" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 获取当前时间五分钟数据 -->
|
||||
<select id="getPortActiveList" resultMap="BaseResultMap">
|
||||
SELECT port ,SUM(sum) sum from galaxy.traffic_port_active_statistic
|
||||
WHERE stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_port_active_statistic)
|
||||
GROUP BY port order by sum desc limit 0,10
|
||||
</select>
|
||||
<!-- 获取上个时间段的数据 -->
|
||||
<select id="getPortActiveOld" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
SELECT SUM(sum) sum from galaxy.traffic_port_active_statistic
|
||||
WHERE port=#{port} and stat_time = DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_port_active_statistic),INTERVAL 5 MINUTE)
|
||||
GROUP BY port ORDER BY sum DESC limit 0,10
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user