@ -9,9 +9,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property= "name" column= "name" />
<result property= "name" column= "name" />
<result property= "version" column= "version" />
<result property= "version" column= "version" />
<result property= "ip" column= "ip" />
<result property= "ip" column= "ip" />
<result property= "manufacture " column= "manufacture" />
<result property= "equManuId " column= "manufacture" />
<result property= "location" column= "location" />
<result property= "location" column= "location" />
<result property= "equType" column= "equ_type" />
<result property= "equTypeId " column= "equ_type" />
<result property= "inCharge" column= "in_charge" />
<result property= "inCharge" column= "in_charge" />
<result property= "installDate" column= "install_date" />
<result property= "installDate" column= "install_date" />
<result property= "lifeCycle" column= "life_cycle" />
<result property= "lifeCycle" column= "life_cycle" />
@ -54,6 +54,8 @@ 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" />
@ -134,48 +136,43 @@ 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
t.id,
c.id,
t.name,
c.name,
t.ip,
c.ip,
t.equType,
c.equTypeId,
t.manufacture,
c.equTypeName,
t.version,
c.equManuId,
t.deviceLevel,
c.equManuName,
t.location,
c.version,
t.status,
c.deviceLevel,
t.cpuUtilization,
c.location,
t.health,
c.status,
t.fanSpeed,
c.cpuUtilization,
t.contWorkPeriod,
c.health,
t.failureFrequency,
c.fanSpeed,
t.unhandledAlertCount
c.contWorkPeriod,
c.unhandledAlertCount,
c.AlertCount
FROM (
FROM (
SELECT
SELECT
b.id,
b.id,
b.name,
b.name,
b.ip,
b.ip,
t.name AS equType,
b.equ_type AS equTypeId,
m.name AS manufacture,
t.name AS equTypeName,
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,
@ -184,23 +181,26 @@ 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 = '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
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
) t
) c
WHERE t .rn = 1
WHERE c .rn = 1
ORDER BY t .id
ORDER BY c .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.id,
t.equNumber,
t.name,
t.name,
t.location,
t.location,
t.cpuUtilization,
t.cpuUtilization,
@ -212,6 +212,7 @@ 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,
@ -234,14 +235,18 @@ 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,
t.name as equType,
b.equ_type as equTypeId,
t.name as equTypeName,
b.status,
b.status,
m.name as manufacture,
b.manufacture as equManuId,
s.name as supplierId,
m.name as equManuName,
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,
@ -251,11 +256,13 @@ 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,
b.failure_frequency AS failureFrequency,
(SELECT COUNT(1)
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 = 'HANDLED') AS unhandledAlertCount,
WHERE a.equ_id = b.id AND a.status = 'UN HANDLED') AS unhandledAlertCount,
g.fan_speed AS fanSpeed,
g.fan_speed AS fanSpeed,
g.cpu_utilization AS cpuUtilization,
g.cpu_utilization AS cpuUtilization,