增加服务器下架处理,

服务器详情增加agent最新版本、cpu核数、内存字段。
开发pppoe主表及子表CRUD
This commit is contained in:
gaoyutao
2025-12-29 18:25:32 +08:00
parent c852fbd506
commit 6e2ca8ac53
23 changed files with 1065 additions and 30 deletions
@@ -37,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRmResourceRegistrationList" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult">
<include refid="selectRmResourceRegistrationVo"/>
<where>
and del_flag=0
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
@@ -252,6 +253,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join rm_registration_machine b on a.client_id = b.client_id
left join rm_frpc_config_manage c on a.client_id=c.client_id
<where>
and a.del_flag=0
<if test="hardwareSn != null and hardwareSn != ''"> and a.hardware_sn = #{hardwareSn}</if>
<if test="resourceType != null and resourceType != ''"> and a.resource_type = #{resourceType}</if>
<if test="agentVersion != null and agentVersion != ''"> and a.agent_version = #{agentVersion}</if>
@@ -295,6 +297,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getCpuUtil" resultType="RmResourceRegistration">
SELECT
d.client_id as clientId,
d.cores as cpuCores,
d.uti as cpuUtil
FROM initial_cpu_info d
INNER JOIN (
@@ -311,16 +314,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND d.create_time = latest.latest_time
</select>
<select id="getMemUtil" resultType="RmResourceRegistration">
SELECT
select
d.client_id as clientId,
ROUND(d.collect_value, 1) as memUtil
max(CASE WHEN d.collect_type = 'memorySizeTotalCollect' THEN floor(d.collect_value/(1024 * 1024)) END) as memTotalSize,
max(CASE WHEN d.collect_type = 'memoryUtilizationCollect' THEN ROUND(d.collect_value, 1) END) as memUtil
FROM initial_system_other_collect_data d
INNER JOIN (
SELECT
client_id,
MAX(create_time) as max_time
FROM initial_system_other_collect_data
WHERE collect_type='memoryUtilizationCollect'
WHERE (collect_type='memoryUtilizationCollect' or collect_type='memorySizeTotalCollect')
AND client_id in
<foreach collection="clientIdsStr.split(',')" item="clientId" open="(" separator="," close=")">
#{clientId}
@@ -328,10 +332,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY client_id
) latest ON d.client_id = latest.client_id
AND d.create_time = latest.max_time
AND d.collect_type='memoryUtilizationCollect'
AND (d.collect_type='memoryUtilizationCollect' or d.collect_type='memorySizeTotalCollect')
</select>
<update id="removeAlarmFlag" parameterType="RmResourceRegistration">
update rm_resource_registration set del_alarm_time = now()
where id =#{id}
</update>
<update id="removeServer" parameterType="String">
update rm_resource_registration set del_flag=1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<select id="getMaxAgentVersion" resultType="RmResourceRegistration">
select agent_version maxAgentVersion from rm_resource_registration where del_flag=0
order by create_time desc limit 1
</select>
</mapper>