@ -24,27 +24,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property= "supplierId" column= "supplier_id" />
<result property= "gatherFrequency" column= "gather_frequency" />
<result property= "equImage" column= "equ_image" />
<result property= "equNumber" column= "equ_number" />
<result property= "repairFrequency" column= "repair_frequency" />
<result property= "repairCost" column= "repair_cost" />
<result property= "fanSpeed" column= "fan_speed" />
<result property= "cpuUtilization" column= "cpu_utilization" />
<result property= "memoryUtilization" column= "memory_utilization" />
<result property= "health" column= "health" />
<result property= "contWorkPeriod" column= "cont_work_period" />
<association property= "manufactureVO" columnPrefix= "equ_manu_" autoMapping= "true" />
<association property= "equTypeVO" columnPrefix= "equ_type_" autoMapping= "true" />
<collection property= "temperatureList" javaType= "java.util.ArrayList" ofType= "java.lang.Float" >
<result column= "temperature_value" />
</collection>
<collection property= "involtageList" javaType= "java.util.ArrayList" ofType= "java.lang.Float" >
<result column= "involtage_value" />
</collection>
<collection property= "outvoltageList" javaType= "java.util.ArrayList" ofType= "java.lang.Float" >
<result column= "outvoltage_value" />
</collection>
<!-- <association property="manufacture" columnPrefix="equ_manu_" autoMapping="true" /> -->
</resultMap>
<resultMap id= "EquMonitorResult" type= "com.alops.system.domain.vo.EquMonitorVO" >
@ -170,82 +156,71 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id= "selectEquMonitorList" parameterType= "EquBaseQueryDto " resultType= "MonitorListDto" >
<select id= "selectEquMonitorListById " parameterType= "string " resultType= "MonitorListDto" >
SELECT
b.id,
b.name,
b.ip,
t.name as equType,
m.name as manufacture,
b.version,
b.device_level,
b.device_level AS deviceLevel ,
b.location,
b.status,
g.cpu_utilization,
g.cpu_utilization AS cpuUtilization ,
g.health,
g.fan_speed,
b.failure_frequency,
b.equ_image
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
<where >
g.cpu_utilization is not null
<if test= "equType != null and equType != ''" >
AND b.equ_type = #{equType}
</if>
<if test= "equName != null and equName != ''" >
AND b.name LIKE concat('%', #{equName}, '%')
</if>
<if test= "location != null and location != ''" >
AND b.location = #{location}
</if>
<if test= "manufacture != null and manufacture != ''" >
AND b.manufacture = #{manufacture}
</if>
<if test= "inCharge != null" >
AND b.in_charge = #{inCharge}
</if>
<if test= "status != null" >
AND b.status = #{status}
</if>
<if test= "minTime != null" >
AND b.create_date <![CDATA[>=]]> #{minTime}
</if>
<if test= "maxTime != null" >
AND b.create_date <![CDATA[<=]]> #{maxTime}
</if>
<if test= "health != null" >
AND g.health <![CDATA[>=]]> #{health}
</if>
</where>
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
ORDER BY g.gather_time desc limit 1
</select>
<select id= "selectEquMonitorById" parameterType= "string" resultType= "MonitorLastDto" >
SELECT
g.cont_work_period,
g.cont_work_period AS contWorkPeriod,
b.equ_image AS equImage,
b.id,
b.name,
b.version,
b.device_level,
t.name as equ_type,
b.device_level AS deviceLevel,
t.name as equType,
b.status,
m.name as manufacture,
s.name as supplier_id,
#b.release_date,
s.name as supplierId,
s.contact_by AS ContactBy,
s.contact_way AS ContactWay,
b.warranty,
m.contact_by as manufacture,
m.contact_way as manufacture,
b.ip,
b.location,
b.install_date,
#b.service_time,
b.in_charge,
b.failure_frequency,
#b.repair_frequency,
#b.service_time/warranty AS aging,
g.fan_speed,
g.cpu_utilization,
g.memory_utilization,
g.health
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 AND a.status = 'HANDLED') AS unhandledAlertCount,
g.fan_speed AS fanSpeed,
g.cpu_utilization AS cpuUtilization,
g.memory_utilization AS memoryUtilization,
g.temperature,
g.health,
g.vol_in AS volIn,
g.vol_out AS volOut
FROM equ_base b
LEFT JOIN equ_manu m ON b.manufacture = m.id
@ -259,11 +234,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY g.gather_time desc limit 1
</select>
<select id= "selectEquMonitorByIdToList" parameterType= "com.alops.system.domain.dto.EquBaseQueryDto" resultType= "map" > SELECT
<select id= "selectEquMonitorByIdToList" parameterType= "com.alops.system.domain.dto.EquBaseQueryDto" resultType= "map" >
SELECT
-- 从 equ_gather 表中获取需要填充到List中的数据
g.temperature AS temperature_value,
g.vol_in AS involtage_value,
g.vol_out AS outvoltage_value,
g.memory_utilization AS memory_value,
g.cpu_utilization AS cpu_value,
g.health AS health_value,
g.gather_time AS gather_time
FROM equ_base b
@ -271,8 +248,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN equ_type t ON b.equ_type = t.id
LEFT JOIN equ_gather g ON b.id = g.equ_id
where g.cpu_utilization is not null
and b.id = #{id}
where b.id = #{id}
-- 添加时间范围约束
and g.gather_time BETWEEN #{minTime} AND #{maxTime}