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

交换机光模块信息数据表分表。
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
@@ -0,0 +1,82 @@
<?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.tongran.rocketmq.mapper.AllMoudleNameMapper">
<resultMap type="AllMoudleName" id="AllMoudleNameResult">
<result property="id" column="id" />
<result property="clientId" column="client_id" />
<result property="name" column="name" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectAllMoudleNameVo">
select id, client_id, name, create_time, update_time from all_moudle_name
</sql>
<select id="selectAllMoudleNameList" parameterType="AllMoudleName" resultMap="AllMoudleNameResult">
<include refid="selectAllMoudleNameVo"/>
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
</where>
</select>
<select id="selectAllMoudleNameById" parameterType="Long" resultMap="AllMoudleNameResult">
<include refid="selectAllMoudleNameVo"/>
where id = #{id}
</select>
<insert id="insertAllMoudleName" parameterType="AllMoudleName" useGeneratedKeys="true" keyProperty="id">
insert into all_moudle_name
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="clientId != null and clientId != ''">client_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="clientId != null and clientId != ''">#{clientId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateAllMoudleName" parameterType="AllMoudleName">
update all_moudle_name
<trim prefix="SET" suffixOverrides=",">
<if test="clientId != null and clientId != ''">client_id = #{clientId},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAllMoudleNameById" parameterType="Long">
delete from all_moudle_name where id = #{id}
</delete>
<delete id="deleteAllMoudleNameByIds" parameterType="String">
delete from all_moudle_name where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchInsertMoudleName" parameterType="java.util.List">
insert IGNORE into all_moudle_name
(client_id, name, create_time, update_time)
values
<foreach collection="list" item="item" separator=",">
(
#{item.clientId},
#{item.name},
#{item.createTime},
#{item.updateTime}
)
</foreach>
</insert>
</mapper>
@@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectInitialSwitchOpticalModuleList" parameterType="InitialSwitchOpticalModule" resultMap="InitialSwitchOpticalModuleResult">
<include refid="selectInitialSwitchOpticalModuleVo"/>
select id, fiber_ent_index, fiber_port_name, hw_entity_optical_tx_low_threshold, hw_entity_optical_rx_low_threshold, hw_entity_optical_rx_power, hw_entity_optical_tx_power, client_id, create_time, update_time, create_by, update_by from ${tableName}
<where>
<if test="fiberEntIndex != null and fiberEntIndex != ''"> and fiber_ent_index = #{fiberEntIndex}</if>
<if test="fiberPortName != null and fiberPortName != ''"> and fiber_port_name like concat('%', #{fiberPortName}, '%')</if>
@@ -101,8 +101,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<insert id="batchInitialSwitchOpticalModule" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
insert IGNORE into initial_switch_optical_module
<insert id="batchInitialSwitchOpticalModule" parameterType="InitialSwitchOpticalModule">
insert IGNORE into ${tableName}
(
fiber_ent_index,
fiber_port_name,
@@ -134,7 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</insert>
<select id="switchOpticalModuleMsg" parameterType="InitialSwitchOpticalModule" resultMap="InitialSwitchOpticalModuleResult">
<include refid="selectInitialSwitchOpticalModuleVo"/>
select id, fiber_ent_index, fiber_port_name, hw_entity_optical_tx_low_threshold, hw_entity_optical_rx_low_threshold, hw_entity_optical_rx_power, hw_entity_optical_tx_power, client_id, create_time, update_time, create_by, update_by from ${tableName}
<where>
<if test="fiberEntIndex != null and fiberEntIndex != ''"> and fiber_ent_index = #{fiberEntIndex}</if>
<if test="fiberPortName != null and fiberPortName != ''"> and fiber_port_name like concat('%', #{fiberPortName}, '%')</if>
@@ -147,17 +147,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time desc limit 1
</select>
<select id="getAllModuleName" parameterType="InitialSwitchOpticalModule" resultType="java.util.Map">
select fiber_port_name fiberPortName from initial_switch_optical_module
select name fiberPortName from all_moudle_name
<where>
<if test="fiberEntIndex != null and fiberEntIndex != ''"> and fiber_ent_index = #{fiberEntIndex}</if>
<if test="fiberPortName != null and fiberPortName != ''"> and fiber_port_name like concat('%', #{fiberPortName}, '%')</if>
<if test="hwEntityOpticalTxLowThreshold != null "> and hw_entity_optical_tx_low_threshold = #{hwEntityOpticalTxLowThreshold}</if>
<if test="hwEntityOpticalRxLowThreshold != null "> and hw_entity_optical_rx_low_threshold = #{hwEntityOpticalRxLowThreshold}</if>
<if test="hwEntityOpticalRxPower != null "> and hw_entity_optical_rx_power = #{hwEntityOpticalRxPower}</if>
<if test="hwEntityOpticalTxPower != null "> and hw_entity_optical_tx_power = #{hwEntityOpticalTxPower}</if>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
</where>
group by fiber_port_name
group by name
</select>
</mapper>
@@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectInitialSystemOtherCollectDataList" parameterType="InitialSystemOtherCollectData" resultMap="InitialSystemOtherCollectDataResult">
<include refid="selectInitialSystemOtherCollectDataVo"/>
select id, client_id, collect_type, collect_value, create_time, update_time, create_by, update_by from ${tableName}
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="collectType != null and collectType != ''"> and collect_type = #{collectType}</if>
@@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertInitialSystemOtherCollectData" parameterType="InitialSystemOtherCollectData" useGeneratedKeys="true" keyProperty="id">
insert IGNORE into initial_system_other_collect_data
insert IGNORE into ${tableName}
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="clientId != null and clientId != ''">client_id,</if>
<if test="collectType != null and collectType != ''">collect_type,</if>
@@ -98,10 +98,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
MAX(CASE WHEN t.collect_type = 'memorySizeAvailableCollect' THEN t.collect_value END) as memorySizeAvailableCollect,
MAX(CASE WHEN t.collect_type = 'memorySizePercentCollect' THEN t.collect_value END) as memorySizePercentCollect,
MAX(CASE WHEN t.collect_type = 'systemUptimeCollect' THEN t.collect_value END) as systemUptimeCollect
FROM `initial_system_other_collect_data` t
FROM ${tableName} t
INNER JOIN (
SELECT collect_type, MAX(create_time) as max_time
FROM `initial_system_other_collect_data`
FROM ${tableName}
WHERE client_id = #{clientId}
GROUP BY collect_type
) latest ON t.collect_type = latest.collect_type AND t.create_time = latest.max_time
@@ -109,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<delete id="deleteInitialSystemOtherCollectData" parameterType="InitialSystemOtherCollectData">
delete from initial_system_other_collect_data
delete from ${tableName}
<where>
<choose>
<when test="clientId != null and collectType != null and createTime != null">