处理磁盘健康数据

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
@@ -63,7 +63,7 @@ public class AllDiskName extends BaseEntity
private String type; private String type;
/** 表名 */ /** 表名 */
private String tableName; private String tableName;
/** 健康状态 0 不健康,1健康 */ /** 健康信息 */
private Long healthStatus; private String healthInfo;
} }
@@ -87,6 +87,8 @@ public class InitialDiskInfo extends BaseEntity
private String unit; private String unit;
/** 健康状态 0-不健康 1-健康) */ /** 健康状态 0-不健康 1-健康) */
private Long healthStatus; private Long healthStatus;
/** 健康分数 */
private Integer healthScore;
} }
@@ -153,7 +153,11 @@
TRUNCATE(IFNULL(b.read_speed,0)/(1024*1024), 0) as readSpeed, TRUNCATE(IFNULL(b.read_speed,0)/(1024*1024), 0) as readSpeed,
b.type, b.type,
TRUNCATE(IFNULL(b.used_space,0)/(1024 * 1024 * 1024), 0) as usedSpace, 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 FROM all_disk_name a
LEFT JOIN ( LEFT JOIN (
SELECT client_id, name, MAX(create_time) as max_create_time SELECT client_id, name, MAX(create_time) as max_create_time
@@ -20,6 +20,7 @@
<result property="type" column="type" /> <result property="type" column="type" />
<result property="usedSpace" column="used_space" /> <result property="usedSpace" column="used_space" />
<result property="healthStatus" column="health_status" /> <result property="healthStatus" column="health_status" />
<result property="healthScore" column="health_score" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
@@ -43,7 +44,7 @@
</select> </select>
<select id="selectInitialDiskInfoListByCondition" parameterType="InitialDiskInfo" resultMap="InitialDiskInfoResult"> <select id="selectInitialDiskInfoListByCondition" parameterType="InitialDiskInfo" resultMap="InitialDiskInfoResult">
select id, client_id, name, serial, total, write_speed, read_speed, write_times, read_times, write_bytes, 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} from ${tableName}
<where> <where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if> <if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
@@ -156,6 +157,7 @@
type, type,
used_space, used_space,
health_status, health_status,
health_score,
create_by, create_by,
update_by, update_by,
create_time, create_time,
@@ -178,6 +180,7 @@
#{item.type}, #{item.type},
#{item.usedSpace}, #{item.usedSpace},
#{item.healthStatus}, #{item.healthStatus},
#{item.healthScore},
#{item.createBy}, #{item.createBy},
#{item.updateBy}, #{item.updateBy},
<choose> <choose>
@@ -202,7 +205,7 @@
<select id="getDistDetailsMsgByClientId" parameterType="InitialDiskInfo" resultMap="InitialDiskInfoResult"> <select id="getDistDetailsMsgByClientId" parameterType="InitialDiskInfo" resultMap="InitialDiskInfoResult">
select id, client_id, name, serial, total, write_speed, read_speed, write_times, read_times, write_bytes, 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} from ${tableName}
where client_id = #{clientId} and `name`= #{name} where client_id = #{clientId} and `name`= #{name}
order by create_time desc order by create_time desc