服务器注册 agent更新

This commit is contained in:
gaoyutao
2025-10-24 09:34:32 +08:00
parent 31d8114c05
commit 37eff51e48
21 changed files with 536 additions and 135 deletions
@@ -46,10 +46,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="multiPublicIpStatus" column="multi_public_ip_status" />
<result property="heartbeatCount" column="heartbeat_count" />
<result property="heartbeatInterval" column="heartbeat_interval" />
<result property="onboardTime" column="onboard_time" />
</resultMap>
<sql id="selectRmResourceRegistrationVo">
select id, hardware_sn, resource_type, resource_name, ip_address, resource_port, other_port_name, agent_version, protocol, resource_version, rw_permission, snmp_detect, team_name, snmp_collect_addr, snmp_collect_port, security_level, encryption, resource_user_name, resource_pwd, registration_status, online_status, switch_online_status, description, customer_id, customer_name, service_number, create_time, update_time, creator_id, creator_name, updater_id, updater_name, client_id, operator, province, public_ip, business_name, logical_node_id, multi_public_ip_status, heartbeat_count, heartbeat_interval from rm_resource_registration
select id, hardware_sn, resource_type, resource_name, ip_address, resource_port, other_port_name,
agent_version, protocol, resource_version, rw_permission, snmp_detect, team_name, snmp_collect_addr,
snmp_collect_port, security_level, encryption, resource_user_name, resource_pwd, registration_status,
online_status, switch_online_status, description, customer_id, customer_name, service_number,
create_time, update_time, creator_id, creator_name, updater_id, updater_name, client_id, operator,
province, public_ip, business_name, logical_node_id, multi_public_ip_status, heartbeat_count,
heartbeat_interval, onboard_time from rm_resource_registration
</sql>
<select id="selectRmResourceRegistrationList" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult">
@@ -144,6 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="multiPublicIpStatus != null">multi_public_ip_status,</if>
<if test="heartbeatCount != null">heartbeat_count,</if>
<if test="heartbeatInterval != null">heartbeat_interval,</if>
<if test="onboardTime != null">onboard_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="hardwareSn != null">#{hardwareSn},</if>
@@ -186,6 +194,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="multiPublicIpStatus != null">#{multiPublicIpStatus},</if>
<if test="heartbeatCount != null">#{heartbeatCount},</if>
<if test="heartbeatInterval != null">#{heartbeatInterval},</if>
<if test="onboardTime != null">#{onboardTime},</if>
</trim>
</insert>
@@ -232,6 +241,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="multiPublicIpStatus != null">multi_public_ip_status = #{multiPublicIpStatus},</if>
<if test="heartbeatCount != null">heartbeat_count = #{heartbeatCount},</if>
<if test="heartbeatInterval != null">heartbeat_interval = #{heartbeatInterval},</if>
<if test="onboardTime != null">onboard_time = #{onboardTime},</if>
</trim>
where id = #{id}
</update>
@@ -329,19 +339,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="creatorName != null">creator_name = #{creatorName},</if>
<if test="updaterId != null">updater_id = #{updaterId},</if>
<if test="updaterName != null">updater_name = #{updaterName},</if>
<if test="onboardTime != null">onboard_time = #{onboardTime},</if>
</trim>
where hardware_sn = #{hardwareSn}
<choose>
<when test="hardwareSn != null">
hardware_sn = #{hardwareSn}
</when>
<when test="clientId != null">
client_id = #{clientId}
</when>
<otherwise>
1=0 <!-- 如果两个条件都不满足,则不更新任何记录 -->
</otherwise>
</choose>
<where>
<choose>
<when test="hardwareSn != null">
and hardware_sn = #{hardwareSn}
</when>
<when test="clientId != null">
and client_id = #{clientId}
</when>
<otherwise>
1=0 <!-- 如果两个条件都不满足,则不更新任何记录 -->
</otherwise>
</choose>
</where>
</update>
<select id="getRegistrationByIds" parameterType="String" resultMap="RmResourceRegistrationResult">
<include refid="selectRmResourceRegistrationVo"/>