2025-08-21 09:28:46 +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.ruoyi.system.mapper.EpsInitialTrafficDataMapper">
|
|
|
|
|
|
|
|
|
|
<update id="createEpsTrafficTable">
|
|
|
|
|
CREATE TABLE IF NOT EXISTS ${tableName} (
|
2025-08-21 18:29:22 +08:00
|
|
|
id BIGINT(20) AUTO_INCREMENT COMMENT '唯一标识ID',
|
|
|
|
|
`name` VARCHAR(100) COMMENT '接口名称',
|
|
|
|
|
`mac` VARCHAR(50) COMMENT 'MAC地址',
|
|
|
|
|
`status` VARCHAR(20) COMMENT '运行状态',
|
|
|
|
|
`type` VARCHAR(30) COMMENT '接口类型',
|
|
|
|
|
ipV4 VARCHAR(20) COMMENT 'IPv4地址',
|
|
|
|
|
`in_dropped` DECIMAL(5,2) COMMENT '入站丢包率(%)',
|
|
|
|
|
`out_dropped` DECIMAL(5,2) COMMENT '出站丢包率(%)',
|
|
|
|
|
`in_speed` varchar(20) COMMENT '接收带宽(Mbps)',
|
|
|
|
|
`out_speed` varchar(20) COMMENT '发送带宽(Mbps)',
|
2025-08-21 09:28:46 +08:00
|
|
|
business_id varchar(12) COMMENT '业务代码',
|
|
|
|
|
business_name varchar(50) COMMENT '业务名称',
|
|
|
|
|
service_sn varchar(50) COMMENT '服务器SN',
|
|
|
|
|
node_name varchar(50) COMMENT '服务器名称',
|
|
|
|
|
revenue_method varchar(50) COMMENT '收益方式(1.流量,2包端)',
|
|
|
|
|
package_bandwidth DECIMAL(10,2) COMMENT '包端带宽值',
|
|
|
|
|
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
|
|
|
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
|
|
|
create_by VARCHAR(50) COMMENT '创建人',
|
|
|
|
|
update_by VARCHAR(50) COMMENT '修改人',
|
2025-08-21 18:29:22 +08:00
|
|
|
client_id VARCHAR(64) COMMENT '设备唯一标识',
|
2025-08-21 09:28:46 +08:00
|
|
|
PRIMARY KEY (id),
|
2025-08-21 18:29:22 +08:00
|
|
|
INDEX idx_name_time (`name`,create_time),
|
2025-08-21 09:28:46 +08:00
|
|
|
INDEX idx_revenue_method (revenue_method),
|
|
|
|
|
INDEX idx_service_sn (service_sn)
|
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='EPS设备流量初始数据表';
|
|
|
|
|
</update>
|
|
|
|
|
<update id="createEpsInitialTrafficTable">
|
|
|
|
|
CREATE TABLE IF NOT EXISTS ${tableName} (
|
2025-08-21 18:29:22 +08:00
|
|
|
id BIGINT(20) AUTO_INCREMENT COMMENT '唯一标识ID',
|
|
|
|
|
`name` VARCHAR(100) COMMENT '接口名称',
|
|
|
|
|
`mac` VARCHAR(20) COMMENT 'MAC地址',
|
|
|
|
|
`status` VARCHAR(20) COMMENT '运行状态',
|
|
|
|
|
`type` VARCHAR(30) COMMENT '接口类型',
|
|
|
|
|
ipV4 VARCHAR(20) COMMENT 'IPv4地址',
|
|
|
|
|
`in_dropped` DECIMAL(5,2) COMMENT '入站丢包率(%)',
|
|
|
|
|
`out_dropped` DECIMAL(5,2) COMMENT '出站丢包率(%)',
|
|
|
|
|
`in_speed` VARCHAR(20) COMMENT '接收带宽(Mbps)',
|
|
|
|
|
`out_speed` VARCHAR(20) COMMENT '发送带宽(Mbps)',
|
2025-08-21 09:28:46 +08:00
|
|
|
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
|
|
|
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
|
|
|
create_by VARCHAR(50) COMMENT '创建人',
|
|
|
|
|
update_by VARCHAR(50) COMMENT '修改人',
|
2025-08-21 18:29:22 +08:00
|
|
|
client_id VARCHAR(64) COMMENT '设备唯一标识',
|
2025-08-21 09:28:46 +08:00
|
|
|
PRIMARY KEY (id),
|
2025-08-21 18:29:22 +08:00
|
|
|
INDEX idx_name_time (`name`,create_time)
|
2025-08-21 09:28:46 +08:00
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='初始带宽流量表';
|
|
|
|
|
</update>
|
2025-08-22 18:13:10 +08:00
|
|
|
<!-- 单条插入语句 -->
|
2025-08-21 09:28:46 +08:00
|
|
|
<insert id="insert">
|
|
|
|
|
INSERT INTO ${tableName} (
|
2025-08-22 18:13:10 +08:00
|
|
|
`name`,
|
|
|
|
|
`mac`,
|
|
|
|
|
`status`,
|
|
|
|
|
`type`,
|
|
|
|
|
ipV4,
|
|
|
|
|
`in_dropped`,
|
|
|
|
|
`out_dropped`,
|
|
|
|
|
`in_speed`,
|
|
|
|
|
`out_speed`,
|
2025-08-21 09:28:46 +08:00
|
|
|
business_id,
|
2025-08-21 18:29:22 +08:00
|
|
|
business_name,
|
|
|
|
|
service_sn,
|
|
|
|
|
node_name,
|
|
|
|
|
revenue_method,
|
|
|
|
|
package_bandwidth,
|
|
|
|
|
create_by,
|
|
|
|
|
update_by,
|
|
|
|
|
client_id
|
2025-08-21 09:28:46 +08:00
|
|
|
) VALUES (
|
2025-08-22 18:13:10 +08:00
|
|
|
#{name},
|
|
|
|
|
#{mac},
|
|
|
|
|
#{status},
|
|
|
|
|
#{type},
|
|
|
|
|
#{ipV4},
|
|
|
|
|
#{inDropped},
|
|
|
|
|
#{outDropped},
|
|
|
|
|
#{inSpeed},
|
|
|
|
|
#{outSpeed},
|
2025-08-21 09:28:46 +08:00
|
|
|
#{businessId},
|
2025-08-21 18:29:22 +08:00
|
|
|
#{businessName},
|
|
|
|
|
#{serviceSn},
|
|
|
|
|
#{nodeName},
|
|
|
|
|
#{revenueMethod},
|
|
|
|
|
#{packageBandwidth},
|
|
|
|
|
#{createBy},
|
|
|
|
|
#{updateBy},
|
|
|
|
|
#{clientId}
|
2025-08-21 09:28:46 +08:00
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
2025-08-22 18:13:10 +08:00
|
|
|
<!-- 批量插入语句 -->
|
2025-08-21 09:28:46 +08:00
|
|
|
<insert id="batchInsert">
|
|
|
|
|
INSERT INTO ${tableName} (
|
2025-08-21 18:29:22 +08:00
|
|
|
id,
|
2025-08-22 18:13:10 +08:00
|
|
|
`name`,
|
|
|
|
|
`mac`,
|
|
|
|
|
`status`,
|
|
|
|
|
`type`,
|
|
|
|
|
ipV4,
|
|
|
|
|
`in_dropped`,
|
|
|
|
|
`out_dropped`,
|
|
|
|
|
`in_speed`,
|
|
|
|
|
`out_speed`,
|
2025-08-21 09:28:46 +08:00
|
|
|
business_id,
|
2025-08-21 18:29:22 +08:00
|
|
|
business_name,
|
|
|
|
|
service_sn,
|
|
|
|
|
node_name,
|
|
|
|
|
revenue_method,
|
|
|
|
|
package_bandwidth,
|
2025-08-21 09:28:46 +08:00
|
|
|
create_time,
|
2025-08-21 18:29:22 +08:00
|
|
|
update_time,
|
|
|
|
|
create_by,
|
|
|
|
|
update_by,
|
|
|
|
|
client_id
|
2025-08-21 09:28:46 +08:00
|
|
|
) VALUES
|
2025-08-22 18:13:10 +08:00
|
|
|
<foreach collection="dataList" item="data" separator=",">
|
2025-08-21 09:28:46 +08:00
|
|
|
(
|
2025-08-21 18:29:22 +08:00
|
|
|
#{data.id,jdbcType=BIGINT},
|
2025-08-22 18:13:10 +08:00
|
|
|
#{data.name,jdbcType=VARCHAR},
|
|
|
|
|
#{data.mac,jdbcType=VARCHAR},
|
|
|
|
|
#{data.status,jdbcType=VARCHAR},
|
|
|
|
|
#{data.type,jdbcType=VARCHAR},
|
|
|
|
|
#{data.ipV4,jdbcType=VARCHAR},
|
|
|
|
|
#{data.inDropped,jdbcType=DECIMAL},
|
|
|
|
|
#{data.outDropped,jdbcType=DECIMAL},
|
|
|
|
|
#{data.inSpeed,jdbcType=VARCHAR},
|
|
|
|
|
#{data.outSpeed,jdbcType=VARCHAR},
|
|
|
|
|
#{data.businessId,jdbcType=VARCHAR},
|
2025-08-21 18:29:22 +08:00
|
|
|
#{data.businessName,jdbcType=VARCHAR},
|
|
|
|
|
#{data.serviceSn,jdbcType=VARCHAR},
|
|
|
|
|
#{data.nodeName,jdbcType=VARCHAR},
|
|
|
|
|
#{data.revenueMethod,jdbcType=VARCHAR},
|
|
|
|
|
#{data.packageBandwidth,jdbcType=DECIMAL},
|
|
|
|
|
#{data.createTime,jdbcType=TIMESTAMP},
|
|
|
|
|
#{data.updateTime,jdbcType=TIMESTAMP},
|
|
|
|
|
#{data.createBy,jdbcType=VARCHAR},
|
|
|
|
|
#{data.updateBy,jdbcType=VARCHAR},
|
|
|
|
|
#{data.clientId,jdbcType=VARCHAR}
|
2025-08-21 09:28:46 +08:00
|
|
|
)
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<!-- 条件查询 -->
|
|
|
|
|
<select id="selectByCondition" resultType="EpsInitialTrafficData">
|
|
|
|
|
SELECT
|
2025-08-21 18:29:22 +08:00
|
|
|
id,
|
2025-08-22 18:13:10 +08:00
|
|
|
`name` AS name,
|
|
|
|
|
`mac` AS mac,
|
|
|
|
|
`status` AS status,
|
|
|
|
|
`type` AS type,
|
|
|
|
|
`ipV4` AS ipV4,
|
|
|
|
|
`in_dropped` AS inDropped,
|
|
|
|
|
`out_dropped` AS outDropped,
|
|
|
|
|
`in_speed` AS inSpeed,
|
|
|
|
|
`out_speed` AS outSpeed,
|
2025-08-21 18:29:22 +08:00
|
|
|
business_id AS businessId,
|
|
|
|
|
business_name AS businessName,
|
|
|
|
|
service_sn AS serviceSn,
|
|
|
|
|
node_name AS nodeName,
|
|
|
|
|
revenue_method AS revenueMethod,
|
|
|
|
|
package_bandwidth AS packageBandwidth,
|
|
|
|
|
create_time AS createTime,
|
|
|
|
|
update_time AS updateTime,
|
|
|
|
|
create_by AS createBy,
|
|
|
|
|
update_by AS updateBy,
|
|
|
|
|
client_id AS clientId
|
2025-08-21 09:28:46 +08:00
|
|
|
FROM ${tableName}
|
|
|
|
|
<where>
|
2025-08-21 18:29:22 +08:00
|
|
|
<if test="serviceSn != '' and serviceSn != null">
|
|
|
|
|
and service_sn = #{serviceSn}
|
2025-08-21 09:28:46 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="startTime != null">
|
|
|
|
|
and create_time >= #{startTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endTime != null">
|
|
|
|
|
and create_time <= #{endTime}
|
|
|
|
|
</if>
|
2025-08-26 19:14:12 +08:00
|
|
|
<if test="revenueMethod != null">
|
|
|
|
|
and revenue_method = #{revenueMethod}
|
|
|
|
|
</if>
|
2025-08-21 09:28:46 +08:00
|
|
|
|
|
|
|
|
</where>
|
|
|
|
|
ORDER BY create_time desc
|
|
|
|
|
</select>
|
2025-08-21 18:29:22 +08:00
|
|
|
|
|
|
|
|
<!-- 条件查询 -->
|
|
|
|
|
<select id="getAllTraficMsg" resultType="EpsInitialTrafficData">
|
|
|
|
|
SELECT
|
|
|
|
|
id,
|
2025-08-22 18:13:10 +08:00
|
|
|
`name` AS name,
|
|
|
|
|
`mac` AS mac,
|
|
|
|
|
`status` AS status,
|
|
|
|
|
`type` AS type,
|
|
|
|
|
`ipV4` AS ipV4,
|
|
|
|
|
`in_dropped` AS inDropped,
|
|
|
|
|
`out_dropped` AS outDropped,
|
|
|
|
|
`in_speed` AS inSpeed,
|
|
|
|
|
`out_speed` AS outSpeed,
|
2025-08-21 18:29:22 +08:00
|
|
|
create_time AS createTime,
|
|
|
|
|
update_time AS updateTime,
|
|
|
|
|
create_by AS createBy,
|
|
|
|
|
update_by AS updateBy,
|
|
|
|
|
client_id AS clientId
|
|
|
|
|
FROM ${tableName}
|
|
|
|
|
<where>
|
|
|
|
|
<if test="startTime != null">
|
|
|
|
|
and create_time >= #{startTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endTime != null">
|
|
|
|
|
and create_time <= #{endTime}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</where>
|
|
|
|
|
ORDER BY create_time desc
|
|
|
|
|
</select>
|
2025-08-21 09:28:46 +08:00
|
|
|
</mapper>
|