|
|
|
|
@ -152,82 +152,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
|
</where> |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<select id="selectEquMonitorListPaged" resultType="MonitorListDto"> |
|
|
|
|
<select id="selectEquMonitorListById" parameterType="string" resultType="MonitorListDto"> |
|
|
|
|
SELECT |
|
|
|
|
t.id, |
|
|
|
|
t.name, |
|
|
|
|
t.ip, |
|
|
|
|
t.equType, |
|
|
|
|
t.manufacture, |
|
|
|
|
t.version, |
|
|
|
|
t.deviceLevel, |
|
|
|
|
t.location, |
|
|
|
|
t.status, |
|
|
|
|
t.cpuUtilization, |
|
|
|
|
t.health, |
|
|
|
|
t.fanSpeed, |
|
|
|
|
t.contWorkPeriod, |
|
|
|
|
t.failureFrequency, |
|
|
|
|
t.unhandledAlertCount |
|
|
|
|
FROM ( |
|
|
|
|
SELECT |
|
|
|
|
b.id, |
|
|
|
|
b.name, |
|
|
|
|
b.ip, |
|
|
|
|
t.name AS equType, |
|
|
|
|
m.name AS manufacture, |
|
|
|
|
b.version, |
|
|
|
|
b.device_level AS deviceLevel, |
|
|
|
|
b.location, |
|
|
|
|
b.status, |
|
|
|
|
g.cpu_utilization AS cpuUtilization, |
|
|
|
|
g.health, |
|
|
|
|
g.fan_speed AS fanSpeed, |
|
|
|
|
g.cont_work_period AS contWorkPeriod, |
|
|
|
|
b.failure_frequency AS failureFrequency, |
|
|
|
|
(SELECT COUNT(1) |
|
|
|
|
FROM alert_message a |
|
|
|
|
WHERE a.equ_id = b.id AND a.status = 'HANDLED') AS unhandledAlertCount, |
|
|
|
|
ROW_NUMBER() OVER (PARTITION BY b.id ORDER BY g.gather_time DESC) AS rn |
|
|
|
|
FROM equ_base b |
|
|
|
|
LEFT JOIN equ_type t ON b.equ_type = t.id |
|
|
|
|
LEFT JOIN equ_manu m ON b.manufacture = m.id |
|
|
|
|
LEFT JOIN equ_gather g ON b.id = g.equ_id |
|
|
|
|
) t |
|
|
|
|
WHERE t.rn = 1 |
|
|
|
|
ORDER BY t.id |
|
|
|
|
</select> |
|
|
|
|
b.id, |
|
|
|
|
b.name, |
|
|
|
|
b.ip, |
|
|
|
|
t.name as equType, |
|
|
|
|
m.name as manufacture, |
|
|
|
|
b.version, |
|
|
|
|
b.device_level AS deviceLevel, |
|
|
|
|
b.location, |
|
|
|
|
b.status, |
|
|
|
|
g.cpu_utilization AS cpuUtilization, |
|
|
|
|
g.health, |
|
|
|
|
g.fan_speed AS fanSpeed, |
|
|
|
|
g.cont_work_period AS contWorkPeriod, |
|
|
|
|
b.failure_frequency AS failureFrequency, |
|
|
|
|
-- 新增列:统计未处理告警数量 |
|
|
|
|
(SELECT COUNT(1) |
|
|
|
|
FROM alert_message a |
|
|
|
|
WHERE a.equ_id = b.id AND a.status = 'HANDLED') AS unhandledAlertCount |
|
|
|
|
FROM equ_base b |
|
|
|
|
LEFT JOIN equ_gather g ON b.id = g.equ_id |
|
|
|
|
LEFT JOIN equ_type t ON b.equ_type = t.id |
|
|
|
|
LEFT JOIN equ_manu m ON b.manufacture = m.id |
|
|
|
|
where b.id = #{id} |
|
|
|
|
AND g.cpu_utilization is not null |
|
|
|
|
|
|
|
|
|
<select id="selectLatestEquMonitorList" resultType="com.alops.system.domain.dto.EquMonitorHomeDto"> |
|
|
|
|
SELECT |
|
|
|
|
t.name, |
|
|
|
|
t.location, |
|
|
|
|
t.cpuUtilization, |
|
|
|
|
t.memoryUtilization, |
|
|
|
|
t.temperature, |
|
|
|
|
t.health, |
|
|
|
|
t.contWorkPeriod, |
|
|
|
|
t.gatherTime |
|
|
|
|
FROM ( |
|
|
|
|
SELECT |
|
|
|
|
b.name, |
|
|
|
|
b.location, |
|
|
|
|
g.cpu_utilization AS cpuUtilization, |
|
|
|
|
g.memory_utilization AS memoryUtilization, |
|
|
|
|
g.temperature, |
|
|
|
|
g.health, |
|
|
|
|
g.cont_work_period AS contWorkPeriod, |
|
|
|
|
g.gather_time AS gatherTime, |
|
|
|
|
ROW_NUMBER() OVER (PARTITION BY b.id ORDER BY g.gather_time DESC) AS rn |
|
|
|
|
FROM equ_base b |
|
|
|
|
LEFT JOIN equ_gather g ON b.id = g.equ_id |
|
|
|
|
WHERE g.cpu_utilization IS NOT NULL |
|
|
|
|
) t |
|
|
|
|
WHERE t.rn = 1 |
|
|
|
|
ORDER BY t.name |
|
|
|
|
ORDER BY g.gather_time desc limit 1 |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectEquMonitorById" parameterType="string" resultType="MonitorLastDto"> |
|
|
|
|
SELECT |
|
|
|
|
g.cont_work_period AS contWorkPeriod, |
|
|
|
|
|