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