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>
|
|
|
|
|
<!-- 单条插入 -->
|
|
|
|
|
<insert id="insert">
|
|
|
|
|
INSERT INTO ${tableName} (
|
2025-08-21 18:29:22 +08:00
|
|
|
interface_name,
|
|
|
|
|
mac_address,
|
|
|
|
|
operation_status,
|
|
|
|
|
interface_type,
|
|
|
|
|
ipv4_address,
|
|
|
|
|
inbound_packet_loss,
|
|
|
|
|
outbound_packet_loss,
|
|
|
|
|
receive_bandwidth,
|
|
|
|
|
send_bandwidth,
|
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-21 18:29:22 +08:00
|
|
|
#{interfaceName},
|
|
|
|
|
#{macAddress},
|
|
|
|
|
#{operationStatus},
|
|
|
|
|
#{interfaceType},
|
|
|
|
|
#{ipv4Address},
|
|
|
|
|
#{inboundPacketLoss},
|
|
|
|
|
#{outboundPacketLoss},
|
|
|
|
|
#{receiveBandwidth},
|
|
|
|
|
#{sendBandwidth},
|
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>
|
|
|
|
|
|
|
|
|
|
<!-- 批量插入 -->
|
|
|
|
|
<insert id="batchInsert">
|
|
|
|
|
INSERT INTO ${tableName} (
|
2025-08-21 18:29:22 +08:00
|
|
|
id,
|
|
|
|
|
interface_name,
|
|
|
|
|
mac_address,
|
|
|
|
|
operation_status,
|
|
|
|
|
interface_type,
|
|
|
|
|
ipv4_address,
|
|
|
|
|
inbound_packet_loss,
|
|
|
|
|
outbound_packet_loss,
|
|
|
|
|
receive_bandwidth,
|
|
|
|
|
send_bandwidth,
|
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-21 18:29:22 +08:00
|
|
|
<foreach collection="list" item="data" separator=",">
|
2025-08-21 09:28:46 +08:00
|
|
|
(
|
2025-08-21 18:29:22 +08:00
|
|
|
#{data.id,jdbcType=BIGINT},
|
|
|
|
|
#{data.interfaceName,jdbcType=VARCHAR},
|
|
|
|
|
#{data.macAddress,jdbcType=CHAR},
|
|
|
|
|
#{data.operationStatus,jdbcType=VARCHAR},
|
|
|
|
|
#{data.interfaceType,jdbcType=VARCHAR},
|
|
|
|
|
#{data.ipv4Address,jdbcType=VARCHAR},
|
|
|
|
|
#{data.inboundPacketLoss,jdbcType=DECIMAL},
|
|
|
|
|
#{data.outboundPacketLoss,jdbcType=DECIMAL},
|
|
|
|
|
#{data.receiveBandwidth,jdbcType=DECIMAL},
|
|
|
|
|
#{data.sendBandwidth,jdbcType=DECIMAL},
|
|
|
|
|
#{data.businessId,jdbcType=CHAR},
|
|
|
|
|
#{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,
|
|
|
|
|
`name` AS interfaceName,
|
|
|
|
|
`mac` AS macAddress,
|
|
|
|
|
`status` AS operationStatus,
|
|
|
|
|
`type` AS interfaceType,
|
|
|
|
|
`ipV4` AS ipv4Address,
|
|
|
|
|
`in_dropped` AS inboundPacketLoss,
|
|
|
|
|
`out_dropped` AS outboundPacketLoss,
|
|
|
|
|
`in_speed` AS receiveBandwidth,
|
|
|
|
|
`out_speed` AS sendBandwidth,
|
|
|
|
|
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>
|
|
|
|
|
|
|
|
|
|
</where>
|
|
|
|
|
ORDER BY create_time desc
|
|
|
|
|
</select>
|
2025-08-21 18:29:22 +08:00
|
|
|
|
|
|
|
|
<!-- 条件查询 -->
|
|
|
|
|
<select id="getAllTraficMsg" resultType="EpsInitialTrafficData">
|
|
|
|
|
SELECT
|
|
|
|
|
id,
|
|
|
|
|
`name` AS interfaceName,
|
|
|
|
|
`mac` AS macAddress,
|
|
|
|
|
`status` AS operationStatus,
|
|
|
|
|
`type` AS interfaceType,
|
|
|
|
|
`ipV4` AS ipv4Address,
|
|
|
|
|
`in_dropped` AS inboundPacketLoss,
|
|
|
|
|
`out_dropped` AS outboundPacketLoss,
|
|
|
|
|
`in_speed` AS receiveBandwidth,
|
|
|
|
|
`out_speed` AS sendBandwidth,
|
|
|
|
|
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>
|