服务器系统其他信息数据表分表。

交换机光模块信息数据表分表。
This commit is contained in:
gaoyutao
2026-01-04 18:10:13 +08:00
parent 4651da4fe4
commit 2593c58741
19 changed files with 597 additions and 49 deletions
@@ -69,4 +69,7 @@ public interface EpsInitialTrafficDataMapper {
List<EpsInitialTrafficData> getTrafficListByClientIds(EpsInitialTrafficData condition);
void createOtherMsgTable(String tableName);
void createSwitchOpMdTable(String tableName);
}
@@ -70,6 +70,10 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
createSwitchInfoTable(year, month);
// 创建交换机流量业务表
createSwitchInfoDetailsTable(year, month);
// 创建服务器其他信息表
createOtherMsgTable(year, month);
// 创建交换机光模块表
createSwitchOpMdTable(year, month);
}
private void createTrafficDetailsTable(int year, int month) {
@@ -100,6 +104,17 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
});
}
private void createOtherMsgTable(int year, int month) {
createRangeTables(year, month, "initial_system_other_collect_data", (tableName) -> {
epsInitialTrafficDataMapper.createOtherMsgTable(tableName);
});
}
private void createSwitchOpMdTable(int year, int month) {
createRangeTables(year, month, "initial_switch_optical_module", (tableName) -> {
epsInitialTrafficDataMapper.createSwitchOpMdTable(tableName);
});
}
/**
* 通用创建表方法
@@ -1159,9 +1159,9 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
String gateWay = mtmNetworks.get(0).getGateway();
routeMsg.setName(mtmNetworks.get(0).getInterfaceName()); // 使用拼接后的网络接口名称
routeMsg.setGateway(gateWay); // 使用第一个网络接口的网关,或者您可以根据需要调整
if(gateWay != null){
rspVo.setAddRoute(JSONObject.toJSONString(routeMsg));
}
// if(gateWay != null){
// rspVo.setAddRoute(JSONObject.toJSONString(routeMsg));
// }
}
rspVo.setNetName(netName);
@@ -169,7 +169,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
INDEX idx_client_time (client_id, name, create_time)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='交换机监控详情表';
</update>
<update id="createOtherMsgTable">
CREATE TABLE IF NOT EXISTS ${tableName} (
id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
client_id VARCHAR(64) COMMENT '客户端ID',
collect_type VARCHAR(100) COMMENT '采集类型',
collect_value LONGTEXT COMMENT '采集值',
create_time DATETIME COMMENT '创建时间',
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
create_by VARCHAR(64) COMMENT '创建人',
update_by VARCHAR(64) COMMENT '修改人',
PRIMARY KEY (id),
UNIQUE KEY uk_client_collect (client_id, collect_type, create_time)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='服务器系统其他信息采集数据表';
</update>
<update id="createSwitchOpMdTable">
CREATE TABLE IF NOT EXISTS ${tableName} (
id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
fiber_ent_index VARCHAR(64) COMMENT '光模块端口索引',
fiber_port_name VARCHAR(128) COMMENT '光模块端口名称',
hw_entity_optical_tx_low_threshold DECIMAL(10,2) COMMENT '光模块发送光衰阈值(dBm)',
hw_entity_optical_rx_low_threshold DECIMAL(10,2) COMMENT '光模块接收光衰阈值(dBm)',
hw_entity_optical_rx_power DECIMAL(10,2) COMMENT '光模块接收功率(dBm)',
hw_entity_optical_tx_power DECIMAL(10,2) COMMENT '光模块发送功率(dBm)',
client_id VARCHAR(64) COMMENT '客户端ID',
create_time DATETIME COMMENT '创建时间',
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
create_by VARCHAR(64) COMMENT '创建人',
update_by VARCHAR(64) COMMENT '修改人',
PRIMARY KEY (id),
UNIQUE KEY uk_client_fiber_time (client_id, create_time, fiber_port_name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='光模块信息表';
</update>
<!-- 单条插入语句 -->
<insert id="insert">
INSERT INTO ${tableName} (