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/NtcReportDao.xml
renkaige 980ecdf7a8 1:新增业务
2:修改统计报表业务
2018-12-17 14:08:03 +06:00

867 lines
27 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.NtcReportDao">
<resultMap id="NtcPzReportMap"
type="com.nis.domain.restful.NtcPzReport">
<result column="CFG_ID" jdbcType="BIGINT" property="cfgId" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap>
<resultMap id="NtcServiceReportMap"
type="com.nis.domain.restful.NtcServiceReport">
<result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap>
<resultMap id="NtcTagReportMap"
type="com.nis.domain.restful.NtcTagReport">
<result column="TAG" jdbcType="INTEGER" property="tag" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap>
<resultMap id="NtcAttrTypeReportMap"
type="com.nis.domain.restful.NtcAttrTypeReport">
<result column="ATTR_TYPE" jdbcType="INTEGER"
property="attrType" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap>
<resultMap id="NtcLwhhReportMap"
type="com.nis.domain.restful.NtcLwhhReport">
<result column="LWHH" jdbcType="INTEGER" property="lwhh" />
<result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap>
<resultMap id="NtcSrcipDomesticReportMap"
type="com.nis.domain.restful.NtcSrcipDomesticReport">
<result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="SRC_PROVINCE" jdbcType="VARCHAR"
property="srcProvince" />
<result column="SRC_CITY" jdbcType="VARCHAR" property="srcCity" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap>
<resultMap id="NtcDestipCountryReportMap"
type="com.nis.domain.restful.NtcDestipCountryReport">
<result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="DEST_COUNTRY" jdbcType="VARCHAR"
property="destCountry" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap>
<resultMap id="NtcEntranceReportMap"
type="com.nis.domain.restful.NtcEntranceReport">
<result column="SERVICE" jdbcType="INTEGER" property="service" />
<result column="ENTRANCE_ID" jdbcType="INTEGER"
property="entranceId" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap>
<resultMap id="NtcIpURLReportMap"
type="com.nis.domain.restful.NtcIpURLReport">
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="ip_addr" jdbcType="VARCHAR" property="ipAddr" />
</resultMap>
<resultMap id="NtcRadiusReportMap"
type="com.nis.domain.restful.NtcRadiusReport">
<result column="ACCOUNT" jdbcType="VARCHAR" property="account" />
<result column="NAS_IP" jdbcType="VARCHAR" property="nasIp" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
property="reportTime" />
</resultMap>
<resultMap id="NtcIpRangeReportMap"
type="com.nis.domain.restful.NtcIpRangeReport">
<result column="ip_start" jdbcType="VARCHAR" property="ipStart" />
<result column="ip_end" jdbcType="VARCHAR" property="ipEnd" />
<result column="ip_start_num" jdbcType="BIGINT"
property="ipStartNum" />
<result column="ip_end_num" jdbcType="BIGINT"
property="ipEndNum" />
<result column="ip_sub" jdbcType="VARCHAR" property="ipSub" />
<result column="country" jdbcType="VARCHAR" property="country" />
</resultMap>
<sql id="commonPorperty">
SERVICE,SUM,REPORT_TIME
</sql>
<select id="findNtcPzReport"
parameterType="com.nis.domain.restful.NtcPzReport"
resultMap="NtcPzReportMap">
SELECT
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 1 ">
<choose>
<when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
CFG_ID,SERVICE,SUM
</otherwise>
</choose>
FROM (SELECT CFG_ID,SERVICE,SUM(SUM) SUM
FROM
</when>
<otherwise>
<choose>
<when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
CFG_ID,
<include refid="commonPorperty" />
</otherwise>
</choose>
FROM (SELECT CFG_ID, SERVICE, SUM(SUM) SUM ,REPORT_TIME
FROM
</otherwise>
</choose>
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_PZ_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_PZ_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 5 ">
NTC_PZ_STAT_MONTH
</when>
<otherwise>
NTC_PZ_REPORT
</otherwise>
</choose>
<where>
<if test="searchCfgId != null and searchCfgId !=''">
<![CDATA[AND CFG_ID in (${searchCfgId})]]>
</if>
<if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]>
</if>
<if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![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')]]>
</if>
</where>
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 1 ">
GROUP BY CFG_ID,SERVICE
)
</when>
<otherwise>
GROUP BY CFG_ID,SERVICE,REPORT_TIME
)
</otherwise>
</choose>
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_PZ_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_PZ_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 5 ">
NTC_PZ_STAT_MONTH
</when>
<otherwise>
NTC_PZ_REPORT
</otherwise>
</choose>
<choose>
<when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findNtcServiceReport"
parameterType="com.nis.domain.restful.NtcServiceReport"
resultMap="NtcServiceReportMap">
SELECT
<choose>
<when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="commonPorperty" />
</otherwise>
</choose>
FROM (SELECT SERVICE, SUM(SUM) SUM ,REPORT_TIME
FROM
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_SERVICE_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_SERVICE_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_SERVICE_STAT_MONTH
</when>
<otherwise>
NTC_SERVICE_REPORT
</otherwise>
</choose>
<where>
<if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]>
</if>
<if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![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')]]>
</if>
</where>
GROUP BY SERVICE,REPORT_TIME
)
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_SERVICE_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_SERVICE_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_SERVICE_STAT_MONTH
</when>
<otherwise>
NTC_SERVICE_REPORT
</otherwise>
</choose>
<choose>
<when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findNtcTagReport"
parameterType="com.nis.domain.restful.NtcTagReport"
resultMap="NtcTagReportMap">
SELECT
<choose>
<when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
TAG,
<include refid="commonPorperty" />
</otherwise>
</choose>
FROM (SELECT SERVICE,TAG,SUM(SUM) SUM ,REPORT_TIME
FROM
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_TAG_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_TAG_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_TAG_STAT_MONTH
</when>
<otherwise>
NTC_TAG_REPORT
</otherwise>
</choose>
<where>
<if test="searchTag != null and searchTag !=''">
<![CDATA[AND TAG in (${searchTag})]]>
</if>
<if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]>
</if>
<if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![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')]]>
</if>
</where>
GROUP BY SERVICE,TAG,REPORT_TIME
)
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_TAG_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_TAG_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_TAG_STAT_MONTH
</when>
<otherwise>
NTC_TAG_REPORT
</otherwise>
</choose>
<choose>
<when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findNtcAttrTypeReport"
parameterType="com.nis.domain.restful.NtcAttrTypeReport"
resultMap="NtcAttrTypeReportMap">
SELECT
<choose>
<when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ATTR_TYPE,
<include refid="commonPorperty" />
</otherwise>
</choose>
FROM (SELECT SERVICE,ATTR_TYPE, SUM(SUM) SUM ,REPORT_TIME
FROM
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_ATTR_TYPE_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_ATTR_TYPE_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_ATTR_TYPE_STAT_MONTH
</when>
<otherwise>
NTC_ATTR_TYPE_REPORT
</otherwise>
</choose>
<where>
<if test="searchAttrType != null and searchAttrType !=''">
<![CDATA[AND ATTR_TYPE in (${searchAttrType})]]>
</if>
<if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]>
</if>
<if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![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')]]>
</if>
</where>
GROUP BY SERVICE,ATTR_TYPE,REPORT_TIME
)
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_ATTR_TYPE_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_ATTR_TYPE_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_ATTR_TYPE_STAT_MONTH
</when>
<otherwise>
NTC_ATTR_TYPE_REPORT
</otherwise>
</choose>
<choose>
<when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findNtcLwhhReport"
parameterType="com.nis.domain.restful.NtcLwhhReport"
resultMap="NtcLwhhReportMap">
SELECT
<choose>
<when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
LWHH,
<include refid="commonPorperty" />
</otherwise>
</choose>
FROM (SELECT SERVICE,LWHH, SUM(SUM) SUM ,REPORT_TIME
FROM
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_LWHH_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_LWHH_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_LWHH_STAT_MONTH
</when>
<otherwise>
NTC_LWHH_REPORT
</otherwise>
</choose>
<where>
<if test="searchLwhh != null and searchLwhh !=''">
<![CDATA[AND LWHH in (${searchLwhh})]]>
</if>
<if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]>
</if>
<if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![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')]]>
</if>
</where>
GROUP BY SERVICE,LWHH,REPORT_TIME
)
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_LWHH_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_LWHH_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_LWHH_STAT_MONTH
</when>
<otherwise>
NTC_LWHH_REPORT
</otherwise>
</choose>
<choose>
<when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findNtcSrcipDomesticReport"
parameterType="com.nis.domain.restful.NtcSrcipDomesticReport"
resultMap="NtcSrcipDomesticReportMap">
SELECT
<choose>
<when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
SRC_PROVINCE,SRC_CITY,
<include refid="commonPorperty" />
</otherwise>
</choose>
FROM (SELECT SERVICE,SRC_PROVINCE,SRC_CITY, SUM(SUM) SUM ,REPORT_TIME
FROM
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_SRCIP_DOMESTIC_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_SRCIP_DOMESTIC_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_SRCIP_DOMESTIC_STAT_MONTH
</when>
<otherwise>
NTC_SRCIP_DOMESTIC_REPORT
</otherwise>
</choose>
<where>
<if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]>
</if>
<if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![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')]]>
</if>
</where>
GROUP BY SERVICE,SRC_PROVINCE,SRC_CITY,REPORT_TIME
)
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_SRCIP_DOMESTIC_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_SRCIP_DOMESTIC_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_SRCIP_DOMESTIC_STAT_MONTH
</when>
<otherwise>
NTC_SRCIP_DOMESTIC_REPORT
</otherwise>
</choose>
<choose>
<when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findNtcDestipCountryReport"
parameterType="com.nis.domain.restful.NtcDestipCountryReport"
resultMap="NtcDestipCountryReportMap">
SELECT
<choose>
<when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
DEST_COUNTRY,
<include refid="commonPorperty" />
</otherwise>
</choose>
FROM (SELECT SERVICE,DEST_COUNTRY, SUM(SUM) SUM ,REPORT_TIME
FROM
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_DESTIP_COUNTRY_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_DESTIP_COUNTRY_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_DESTIP_COUNTRY_STAT_MONTH
</when>
<otherwise>
NTC_DESTIP_COUNTRY_REPORT
</otherwise>
</choose>
<where>
<if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]>
</if>
<if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![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')]]>
</if>
</where>
GROUP BY SERVICE,DEST_COUNTRY,REPORT_TIME
)
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_DESTIP_COUNTRY_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_DESTIP_COUNTRY_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_DESTIP_COUNTRY_STAT_MONTH
</when>
<otherwise>
NTC_DESTIP_COUNTRY_REPORT
</otherwise>
</choose>
<choose>
<when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findNtcEntranceReport"
parameterType="com.nis.domain.restful.NtcEntranceReport"
resultMap="NtcEntranceReportMap">
SELECT
<choose>
<when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
ENTRANCE_ID,
<include refid="commonPorperty" />
</otherwise>
</choose>
FROM (SELECT SERVICE,ENTRANCE_ID, SUM(SUM) SUM ,REPORT_TIME
FROM
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_ENTRANCE_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_ENTRANCE_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_ENTRANCE_STAT_MONTH
</when>
<otherwise>
NTC_ENTRANCE_REPORT
</otherwise>
</choose>
<where>
<if test="searchEntrance != null and searchEntrance !=''">
<![CDATA[AND ENTRANCE_ID in (${searchEntrance})]]>
</if>
<if test="searchService != null and searchService !=''">
<![CDATA[AND SERVICE in (${searchService})]]>
</if>
<if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![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')]]>
</if>
</where>
GROUP BY SERVICE,ENTRANCE_ID,REPORT_TIME
)
<choose>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
NTC_ENTRANCE_STAT_HOUR
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
NTC_ENTRANCE_STAT_DAILY
</when>
<when
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
NTC_ENTRANCE_STAT_MONTH
</when>
<otherwise>
NTC_ENTRANCE_REPORT
</otherwise>
</choose>
<choose>
<when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findNtcIpURLReport"
parameterType="com.nis.domain.restful.NtcURLReport"
resultMap="NtcIpURLReportMap">
SELECT
<choose>
<when
test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
url, ip_addr,SUM
</otherwise>
</choose>
FROM (SELECT url, SUM(SUM) SUM ,ip_addr
FROM ntc_reject_url_statistic
<where>
<if
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND STAT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
</if>
<if
test="searchReportEndTime != null and searchReportEndTime !=''">
<![CDATA[AND STAT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</if>
<if test="searchUrl != null and searchUrl !=''">
AND url = #{searchUrl}
</if>
</where>
GROUP BY url,ip_addr
) ntc_reject_url_statistic
<choose>
<when
test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
</choose>
</select>
<select id="findNasIpList"
parameterType="com.nis.domain.restful.NtcRadiusReport"
resultMap="NtcRadiusReportMap">
select nas_ip,sum(num) num from ntc_radius_report
<where>
<choose>
<when
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s') AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</when>
<otherwise>
and REPORT_TIME>=DATE_SUB(now(), INTERVAL 1 HOUR)
</otherwise>
</choose>
</where>
group by NAS_IP order by num desc
</select>
<select id="findAccounList"
parameterType="com.nis.domain.restful.NtcRadiusReport"
resultMap="NtcRadiusReportMap">
select account,sum(num) num from ntc_radius_report
<where>
<choose>
<when
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s') AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</when>
<otherwise>
and REPORT_TIME>DATE_SUB(now(), INTERVAL 1 HOUR)
</otherwise>
</choose>
</where>
group by account order by num desc
</select>
<select id="findNtcRadiusReport"
parameterType="com.nis.domain.restful.NtcRadiusReport"
resultMap="NtcRadiusReportMap">
SELECT
*
FROM ntc_radius_report
<where>
<if
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 and searchAccount != null and searchAccount !=''">
<![CDATA[AND account =#{searchAccount}]]>
</if>
<if
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 and searchNasIp != null and searchNasIp !=''">
<![CDATA[AND nas_ip =#{searchNasIp}]]>
</if>
<choose>
<when
test="searchReportStartTime != null and searchReportStartTime !=''">
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s') AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
</when>
<otherwise>
<![CDATA[AND REPORT_TIME>DATE_SUB(now(), INTERVAL 1 HOUR) ]]>
</otherwise>
</choose>
</where>
ORDER BY
REPORT_TIME ASC
</select>
<select id="findNtcIpRangeReport"
parameterType="com.nis.domain.restful.NtcIpRangeReport"
resultMap="NtcIpRangeReportMap">
SELECT ip_start,ip_end,ip_start_num,ip_end_num,ip_sub
FROM traffic_ip_identify
<where>
<if test="searchType != null and searchType !=''">
<![CDATA[AND areaType = #{searchType}]]>
</if>
<if test="searchCountry != null and searchCountry !=''">
<![CDATA[AND country= #{searchCountry ]]>
</if>
</where>
</select>
</mapper>