1、把sql语句中的时间条件查询改为左闭右开

2、DashboardService中无用的方法添加@Deprecated注解
This commit is contained in:
zhangdongxu
2018-12-24 19:08:01 +08:00
parent c50d92d265
commit ac5d0cc739
8 changed files with 30 additions and 24 deletions

View File

@@ -170,11 +170,11 @@
</if>
<if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME > STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
</if>
<if
test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME <= STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</if>
</where>
<choose>

View File

@@ -170,11 +170,11 @@
</if>
<if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME > STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
</if>
<if
test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND REPORT_TIME <= STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</if>
</where>
<choose>
@@ -960,7 +960,7 @@
<!-- 获取近一小时的带宽根据ip46协议 tcp,udp变化 -->
<select id="getBandwidthTrans" resultMap="BandwidthResultMap">
select IFNULL((SUM(c2s_byte_len+s2c_byte_len)*8)/300/1024/1024/1024,0) gbps,IFNULL(SUM(c2s_pkt_num+s2c_pkt_num)/300,0) pps,IFNULL(SUM(link_num),0) linkNum, stat_time time from traffic_trans_statistic
where <![CDATA[stat_time>=#{beginDate} and stat_time<=#{endDate} ]]>
where <![CDATA[stat_time>=#{beginDate} and stat_time<#{endDate} ]]>
<if test="addrType != null">
and addr_type=#{addrType}
</if>
@@ -973,7 +973,7 @@
<!-- 获取近一小时的带宽根据ip46协议 tcp,udp变化 -->
<select id="getBandwidthTrans2" resultMap="BandwidthResultMap">
select addr_type,trans_type,entrance_id,IFNULL((SUM(c2s_byte_len+s2c_byte_len)*8)/300/1024/1024/1024,0) gbps,IFNULL(SUM(c2s_pkt_num+s2c_pkt_num)/300,0) pps,IFNULL(SUM(link_num),0) linkNum, stat_time time from traffic_trans_statistic
where <![CDATA[stat_time<=#{endDate} and stat_time>=#{beginDate}]]>
where <![CDATA[stat_time<#{endDate} and stat_time>=#{beginDate}]]>
and addr_type !=0
and trans_type!=0
group by stat_time,addr_type,trans_type order by stat_time
@@ -988,7 +988,7 @@
<!-- entrance 1,2 ,动作为阻断,近一小时 间隔5分钟数据 -->
<select id="getActionTrans" resultType="com.nis.domain.restful.NtcEntranceReport">
select sum(sum) sum,report_time time from ntc_entrance_report r where
<![CDATA[${serviceSql} and report_time<=#{endDate} and report_time>=#{beginDate}]]>
<![CDATA[${serviceSql} and report_time<#{endDate} and report_time>=#{beginDate}]]>
and entrance_id=#{entranceId}
group by report_time order by report_time
</select>

View File

@@ -129,7 +129,7 @@
<!-- entrance 1,2 ,动作为阻断,近一小时 间隔5分钟数据 -->
<select id="getActionTrans" resultType="com.nis.domain.restful.NtcEntranceReport">
select sum(sum) sum,report_time reportTime from ntc_entrance_report r where
<![CDATA[${serviceSql} and report_time<=#{endDate} and report_time>=#{beginDate}]]>
<![CDATA[${serviceSql} and report_time<#{endDate} and report_time>=#{beginDate}]]>
and entrance_id=#{entranceId}
group by report_time order by report_time
</select>

View File

@@ -32,7 +32,7 @@
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}]]>
<![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=")">

View File

@@ -125,7 +125,7 @@ FROM
<select id="getTrafficHttpDomain" resultType="java.util.HashMap">
select web_id webId, max(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}]]>
<![CDATA[ stat_time>= #{beginDate} and stat_time< #{endDate}]]>
<if test="domain!=null">
and web_id in
<foreach collection="domain" index="index" item="item" open="(" separator="," close=")">

View File

@@ -71,7 +71,7 @@
<select id="ipActiveOneHour" resultType="java.util.HashMap">
SELECT ip_addr ipAddr,area_id areaId,SUM(c2s_byte_len+s2c_byte_len) count, link_num linkNum ,c2s_pkt_num c2sPktNum,s2c_pkt_num s2cPktNum,c2s_byte_len c2sByteLen,s2c_byte_len s2cByteLen,date_format(stat_time, '%Y-%m-%d %H:%i:%s') statTime FROM traffic_ip_active_statistic
WHERE ip_addr=#{ipAddr}
and <![CDATA[ stat_time> #{beginDate} and stat_time<=#{endDate}]]> GROUP BY statTime
and <![CDATA[ stat_time>= #{beginDate} and stat_time<#{endDate}]]> GROUP BY statTime
ORDER BY count DESC LIMIT 1
</select>

View File

@@ -29,7 +29,7 @@
SELECT proto_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_protocol_statistic WHERE
<![CDATA[ stat_time>= #{beginTime} and stat_time<= #{endTime}]]>
<![CDATA[ stat_time>= #{beginTime} and stat_time< #{endTime}]]>
<if test="protoType!=null">
and proto_type in
<foreach collection="protoType" index="index" item="item" open="(" separator="," close=")">