处理磁盘健康数据

This commit is contained in:
gaoyutao
2026-02-06 17:11:00 +08:00
parent 60db343cb0
commit 0fdce6b13b
4 changed files with 14 additions and 5 deletions
@@ -153,7 +153,11 @@
TRUNCATE(IFNULL(b.read_speed,0)/(1024*1024), 0) as readSpeed,
b.type,
TRUNCATE(IFNULL(b.used_space,0)/(1024 * 1024 * 1024), 0) as usedSpace,
b.health_status as healthStatus
CASE
WHEN b.health_score IS NOT NULL THEN b.health_score
WHEN b.health_status = 1 THEN '健康'
WHEN b.health_status = 0 THEN '不健康' ELSE null
END AS healthInfo
FROM all_disk_name a
LEFT JOIN (
SELECT client_id, name, MAX(create_time) as max_create_time
@@ -20,6 +20,7 @@
<result property="type" column="type" />
<result property="usedSpace" column="used_space" />
<result property="healthStatus" column="health_status" />
<result property="healthScore" column="health_score" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" />
@@ -43,7 +44,7 @@
</select>
<select id="selectInitialDiskInfoListByCondition" parameterType="InitialDiskInfo" resultMap="InitialDiskInfoResult">
select id, client_id, name, serial, total, write_speed, read_speed, write_times, read_times, write_bytes,
read_bytes, type, used_space,health_status, create_by, update_by, create_time, update_time
read_bytes, type, used_space,health_status, health_score, create_by, update_by, create_time, update_time
from ${tableName}
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
@@ -156,6 +157,7 @@
type,
used_space,
health_status,
health_score,
create_by,
update_by,
create_time,
@@ -178,6 +180,7 @@
#{item.type},
#{item.usedSpace},
#{item.healthStatus},
#{item.healthScore},
#{item.createBy},
#{item.updateBy},
<choose>
@@ -202,7 +205,7 @@
<select id="getDistDetailsMsgByClientId" parameterType="InitialDiskInfo" resultMap="InitialDiskInfoResult">
select id, client_id, name, serial, total, write_speed, read_speed, write_times, read_times, write_bytes,
read_bytes, type, used_space,health_status, create_by, update_by, create_time, update_time
read_bytes, type, used_space,health_status, health_score, create_by, update_by, create_time, update_time
from ${tableName}
where client_id = #{clientId} and `name`= #{name}
order by create_time desc