@ -57,6 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property= "cpuUtilization" column= "cpu_utilization" />
<result property= "memoryUtilization" column= "memory_utilization" />
<result property= "health" column= "health" />
<result property= "equImage" column= "equ_image" />
<result property= "equNumber" column= "equ_number" />
<result property= "contWorkPeriod" column= "cont_work_period" />
<association property= "manufactureVO" columnPrefix= "equ_manu_" autoMapping= "true" />
<association property= "equTypeVO" columnPrefix= "equ_type_" autoMapping= "true" />
@ -179,48 +181,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) tmp ON eg.equ_id = tmp.equ_id AND eg.gather_time = tmp.max_time
) g ON b.id = g.equ_id
<where >
<if test= "name != null and name != ''" >
AND b.name LIKE CONCAT('%', #{name}, '%')
</if>
<if test= "location != null and location != ''" >
AND b.location LIKE CONCAT('%', #{location}, '%')
</if>
<if test= "minTime != null" >
AND b.create_date > = #{minTime}
</if>
<if test= "maxTime != null" >
AND b.create_date < = #{maxTime}
</if>
<if test= "status != null" >
AND b.status = #{status}
</if>
</where>
</select>
<select id= "selectEquMonitorListPaged" 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
c.id,
c.name,
c.ip,
c.equTypeId,
c.equTypeName,
c.equManuId,
c.equManuName,
c.version,
c.deviceLevel,
c.location,
c.status,
c.cpuUtilization,
c.health,
c.fanSpeed,
c.contWorkPeriod,
c.unhandledAlertCount,
c.AlertCount
FROM (
SELECT
b.id,
b.name,
b.ip,
t.name AS equType,
m.name AS manufacture,
b.equ_type AS equTypeId,
t.name AS equTypeName,
b.manufacture AS equManuId,
m.name AS equManuName,
b.version,
b.device_level AS deviceLevel,
b.location,
@ -229,22 +226,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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,
WHERE a.equ_id = b.id AND a.status = 'UNHANDLED') AS unhandledAlertCount,
(SELECT COUNT(1)
FROM alert_message a
WHERE a.equ_id = b.id ) AS AlertCount,
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
) c
WHERE c .rn = 1
ORDER BY c .id
</select>
<select id= "selectLatestEquMonitorList" resultType= "com.alops.system.domain.dto.EquMonitorHomeDto" >
SELECT
t.id,
t.equNumber,
t.name,
t.location,
t.cpuUtilization,
@ -256,6 +257,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM (
SELECT
b.id,
b.equ_number as equNumber,
b.name,
b.location,
g.cpu_utilization AS cpuUtilization,
@ -278,14 +280,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
g.cont_work_period AS contWorkPeriod,
b.equ_image AS equImage,
b.id,
b.equ_number as equNumber,
b.name,
b.version,
b.device_level AS deviceLevel,
t.name as equType,
b.equ_type as equTypeId,
t.name as equTypeName,
b.status,
m.name as manufacture,
s.name as supplierId,
b.manufacture as equManuId,
m.name as equManuName,
b.supplier_id as supplierId,
s.name as supplierName,
s.contact_by AS ContactBy,
s.contact_way AS ContactWay,
b.warranty,
@ -295,11 +301,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.install_date AS installDate,
b.in_charge AS inCharge,
b.failure_frequency AS failureFrequency,
(SELECT COUNT(1)
FROM alert_message a
WHERE a.equ_id = b.id ) AS AlertCount,
-- 新增列:统计未处理告警数量
(SELECT COUNT(1)
FROM alert_message a
WHERE a.equ_id = b.id AND a.status = 'HANDLED') AS unhandledAlertCount,
WHERE a.equ_id = b.id AND a.status = 'UN HANDLED') AS unhandledAlertCount,
g.fan_speed AS fanSpeed,
g.cpu_utilization AS cpuUtilization,