# Conflicts:
#	ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquBase.java
dev
YYD-YY 9 months ago
commit 534a160702
  1. 3
      ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/ScheduleRulesController.java
  2. 10
      ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/AlertMessageController.java
  3. 41
      ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/exceptionController/equAssessment.java
  4. 12
      ALOps_sys_backend/alops-system/pom.xml
  5. 29
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/EquBase.java
  6. 112
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/EquBaseAddDto.java
  7. 8
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/EquBaseQueryDto.java
  8. 48
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/equipmentAssessmentDto.java
  9. 45
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/vo/equipmentAssessmentVo.java
  10. 3
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/vo/homeEquAlertMessageVo.java
  11. 18
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/vo/queryEquBaseVO.java
  12. 4
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/AlertMessageMapper.java
  13. 6
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/EquBaseMapper.java
  14. 2
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/mapper/ScheduleRulesMapper.java
  15. 4
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IAlertMessageService.java
  16. 4
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IEquBaseService.java
  17. 2
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/IScheduleRulesService.java
  18. 5
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/AlertMessageServiceImpl.java
  19. 98
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/EquBaseServiceImpl.java
  20. 17
      ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/ScheduleRulesServiceImpl.java
  21. 2
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/AlertMessageMapper.xml
  22. 59
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/EquBaseMapper.xml
  23. 6
      ALOps_sys_backend/alops-system/src/main/resources/mapper/system/ScheduleRulesMapper.xml

@ -60,6 +60,9 @@ public class ScheduleRulesController extends BaseController
@ApiOperation("立即确定")
public AjaxResult run(@RequestBody ScheduleRules newRule) throws SchedulerException, ExecutionException, InterruptedException {
if(scheduleRulesService.checkRunningOrWaitingRules()){
return AjaxResult.error("正在采集,请稍后");
}
if (newRule.getRuleType() == 2) {
// 立即执行

@ -1,22 +1,16 @@
package com.alops.web.controller.exceptionController;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.alops.common.annotation.Log;
import com.alops.common.core.controller.BaseController;
import com.alops.common.core.domain.AjaxResult;
import com.alops.common.core.page.TableDataInfo;
import com.alops.common.enums.BusinessType;
import com.alops.common.utils.SecurityUtils;
import com.alops.common.utils.poi.ExcelUtil;
import com.alops.system.domain.AlertMessage;
import com.alops.system.domain.dto.AlertDto;
import com.alops.system.domain.vo.homeEquAlertMessage;
import com.alops.system.domain.vo.homeEquAlertMessageVo;
import com.alops.system.service.IAlertLaunchService;
import com.alops.system.domain.AlertRule;
import com.alops.system.domain.EquInterface;
import com.alops.system.domain.dto.AlertStatisticDto;
import com.alops.system.service.IAlertMessageService;
import io.swagger.annotations.ApiOperation;
@ -92,7 +86,7 @@ public class AlertMessageController extends BaseController
public TableDataInfo homeList()
{
startPage();
List<homeEquAlertMessage> list = alertMessageService.selectStaticAlertMessageList();
List<homeEquAlertMessageVo> list = alertMessageService.selectStaticAlertMessageList();
return getDataTable(list);
}

@ -0,0 +1,41 @@
package com.alops.web.controller.exceptionController;
import com.alops.common.annotation.Log;
import com.alops.common.core.controller.BaseController;
import com.alops.common.core.page.TableDataInfo;
import com.alops.common.enums.BusinessType;
import com.alops.system.domain.vo.equipmentAssessmentVo;
import com.alops.system.service.IEquBaseService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/inMonitoring/equAssessment")
public class equAssessment extends BaseController {
@Autowired
public IEquBaseService iEquBaseService;
/**
* 设备信息评估表
* 获取所有设备id
*/
@PreAuthorize("@ss.hasPermi('inMonitoring:equAssessment:list')")
@GetMapping("/list")
@ApiOperation("设备评估信息")
@Log(title = "设备评估与预测", businessType = BusinessType.UPDATE)
public TableDataInfo homeList()
{
startPage();
List<equipmentAssessmentVo> list = iEquBaseService.getDeviceIAssessmentnfo();
return getDataTable(list);
}
}

@ -16,6 +16,18 @@
<description>
system系统模块
</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>14</source>
<target>14</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- org.snmp4j -->

@ -160,16 +160,6 @@ public class EquBase
return ip;
}
public void setManufacture(String manufacture)
{
this.equManuId = manufacture;
}
public String getManufacture()
{
return equManuId;
}
public void setLocation(String location)
{
this.location = location;
@ -180,16 +170,6 @@ public class EquBase
return location;
}
public void setEquType(String equType)
{
this.equTypeId = equType;
}
public String getEquType()
{
return equTypeId;
}
public void setInCharge(String inCharge)
{
this.inCharge = inCharge;
@ -290,6 +270,11 @@ public class EquBase
return gatherFrequency;
}
public String getEquManuId() { return equManuId; }
public void setEquManuId(String equManuId) { this.equManuId = equManuId; }
public String getEquTypeId() { return equTypeId; }
public void setEquTypeId(String equTypeId) { this.equTypeId = equTypeId; }
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -297,9 +282,9 @@ public class EquBase
.append("name", getName())
.append("version", getVersion())
.append("ip", getIp())
.append("manufacture", getManufacture())
.append("equManuId", getEquManuId())
.append("location", getLocation())
.append("equType", getEquType())
.append("equTypeId", getEquTypeId())
.append("inCharge", getInCharge())
.append("installDate", getInstallDate())
.append("lifeCycle", getLifeCycle())

@ -0,0 +1,112 @@
package com.alops.system.domain.dto;
import com.alops.common.annotation.Excel;
import com.alops.system.domain.EquManu;
import com.alops.system.domain.EquType;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class EquBaseAddDto {
private static final long serialVersionUID = 1L;
/** 设备唯一标识(设备编号) */
private String id;
/** (设备编号) */
private String equNumber;
/** 设备名称 */
@Excel(name = "设备名称")
private String name;
/** 设备版本 */
@Excel(name = "设备版本")
private String version;
/** 带外管理 IP */
@Excel(name = "带外管理 IP")
private String ip;
/** 设备厂商 id */
@Excel(name = "设备厂商 id")
private String manufacture;
private EquManu manufactureVO;
/** 安装位置 */
@Excel(name = "安装位置 ")
private String location;
/** 设备类型 id */
@Excel(name = "设备类型 id")
private String equType;
public EquType getEquTypeVO() {
return equTypeVO;
}
public void setEquTypeVO(EquType equTypeVO) {
this.equTypeVO = equTypeVO;
}
private EquType equTypeVO;
/** 设备管理员姓名 */
@Excel(name = "设备管理员姓名")
private String inCharge;
/** 安装日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "安装日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date installDate;
/** 预计年限(年) */
@Excel(name = "预计年限(年)")
private Long lifeCycle;
/** 质保时间(年) */
@Excel(name = "质保时间(年)")
private Long warranty;
/** 添加日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "添加日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date createDate;
/** 启用状态(1启用0禁用) */
@Excel(name = "启用状态", readConverterExp = "0=启用1禁用")
private Long status;
/** 累计预警次数 */
@Excel(name = "累计预警次数")
private Long failureFrequency;
/** 设备级别 */
@Excel(name = "设备级别")
private String deviceLevel;
/** 供应商id */
@Excel(name = "供应商id")
private String supplierId;
/** 采集次数 */
@Excel(name = "采集次数")
private Long gatherFrequency;
@Excel(name = "采集次数")
private Long createBy ;
@Excel(name = "设备图片地址")
private String equImage ;
}

@ -16,7 +16,8 @@ public class EquBaseQueryDto implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
/** 设备类型 (equ_type, varchar) */
private String equTypeId;
/** 设备类型 (equ_type, varchar) */
private String equTypeId;
/** 设备类型 (equ_type, varchar) */
@ -26,9 +27,6 @@ public class EquBaseQueryDto implements Serializable {
/** 安装位置 ID (location, varchar) */
private String location;
/** 起始时间 (min_time) */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date minTime;
@ -41,8 +39,6 @@ public class EquBaseQueryDto implements Serializable {
private Integer status;
// ====== Getter 和 Setter ======
public String getName() {
return name;
}

@ -0,0 +1,48 @@
package com.alops.system.domain.dto;
import com.alops.common.annotation.Excel;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class equipmentAssessmentDto {
/** 设备唯一标识(设备编号) */
private String id;
/** (设备编号) */
private String equNumber;
/** 设备名称 */
@Excel(name = "设备名称")
private String name;
/** 安装位置 */
@Excel(name = "安装位置 ")
private String location;
/** 设备类型 id */
@Excel(name = "设备类型名称")
private String equType;
/** 设备级别 */
@Excel(name = "设备级别")
private String deviceLevel;
@Excel(name = "综合计算的健康度指标(%)")
private BigDecimal health;
/** 设备温度 */
@Excel(name = "设备温度")
private BigDecimal temperature;
/** CPU 使用率(%) */
@Excel(name = "CPU 使用率(%)")
private BigDecimal cpuUtilization;
/** 内存使用率(%) */
@Excel(name = "内存使用率(%)")
private BigDecimal memoryUtilization;
}

@ -0,0 +1,45 @@
package com.alops.system.domain.vo;
import com.alops.common.annotation.Excel;
import lombok.Data;
@Data
public class equipmentAssessmentVo {
/** 设备唯一标识(设备编号) */
private String id;
/** (设备编号) */
private String equNumber;
/** 设备名称 */
@Excel(name = "设备名称")
private String name;
/** 安装位置 */
@Excel(name = "安装位置 ")
private String location;
/** 设备类型 id */
@Excel(name = "设备类型名称")
private String equType;
/** 设备级别 */
@Excel(name = "设备级别")
private String deviceLevel;
/** CPU使用率(%) */
private String cpuStatus;
/** 内存使用率(%) */
private String memoryStatus;
/** 温度(℃) */
private String temperatureStatus;
/** 健康状态(健康、良好、一般、需维护) */
private String healthStatus;
/** 风险等级 */
private String riskGrade ;
}

@ -1,13 +1,12 @@
package com.alops.system.domain.vo;
import com.alops.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class homeEquAlertMessage {
public class homeEquAlertMessageVo {
/** 预警级别(1-5级) */

@ -39,17 +39,23 @@ public class queryEquBaseVO {
/** 带外管理 IP */
@Excel(name = "带外管理 IP")
private String ip;
@Excel(name = "设备厂商名称id ")
private String equManuId;
/** 设备厂商 */
@Excel(name = "设备厂商名称 ")
private String manuName;
private String manufacture;
/** 设备厂商 */
@Excel(name = "设备厂商名称 ")
@Excel(name = "设备供应商名称 ")
private String supplierId;
/** 安装位置 id */
@Excel(name = "设备供应商名称 ")
private String supplierName;
/** 安装位置 id */
@Excel(name = "安装位置 id")
private String location;
/** 设备类型 id */
/** 设备类型 id */
@Excel(name = "设备类型id")
private String equTypeId;
@Excel(name = "设备类型名称")
private String equType;
@ -91,6 +97,8 @@ public class queryEquBaseVO {
@Excel(name = "设备图片")
private String equImage;
@Excel(name = "设备编号")
private String equNumber;
public void setId(String id)
@ -230,7 +238,7 @@ public class queryEquBaseVO {
.append("version", getVersion())
.append("ip", getIp())
.append("supplierName", getSupplierName())
.append("manuName", getManuName())
.append("manuName", getManufacture())
.append("location", getLocation())
.append("equType", getEquType())
.append("inCharge", getInCharge())

@ -2,7 +2,7 @@ package com.alops.system.mapper;
import com.alops.system.domain.AlertMessage;
import com.alops.system.domain.dto.AlertDto;
import com.alops.system.domain.vo.homeEquAlertMessage;
import com.alops.system.domain.vo.homeEquAlertMessageVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -46,7 +46,7 @@ public interface AlertMessageMapper
*/
public List<AlertMessage> selectAlertMessageList(AlertDto alertMessage);
public List<homeEquAlertMessage> selectStaticAlertMessageList();
public List<homeEquAlertMessageVo> selectStaticAlertMessageList();
public ArrayList<AlertMessage> selectAlertMessageByEquId(Long Equid);
/**

@ -21,6 +21,12 @@ import org.springframework.data.repository.query.Param;
@Mapper
public interface EquBaseMapper
{
/**
* 查询状态为1的设备及其最新采集信息和类型名称
*/
List<equipmentAssessmentDto> getEquipmentAssessmentList();
int incrementCollectCount(@Param("ids") List<String> ids);
@Update("DELETE FROM equ_interface")

@ -17,6 +17,8 @@ public interface ScheduleRulesMapper
public List<ScheduleRules> selectList();
public List<ScheduleRules> selectListOne();
/**
* 查询定时采集规则
*

@ -3,7 +3,7 @@ package com.alops.system.service;
import com.alops.system.domain.AlertMessage;
import com.alops.system.domain.dto.AlertDto;
import com.alops.system.domain.dto.AlertStatisticDto;
import com.alops.system.domain.vo.homeEquAlertMessage;
import com.alops.system.domain.vo.homeEquAlertMessageVo;
import java.util.List;
@ -31,7 +31,7 @@ public interface IAlertMessageService
* @return 故障统计集合
*/
public List<AlertMessage> selectAlertMessageList(AlertDto alertMessage);
public List<homeEquAlertMessage> selectStaticAlertMessageList();
public List<homeEquAlertMessageVo> selectStaticAlertMessageList();
public List<AlertMessage> selectAlertMessageListByEquId(Long equId);
/**

@ -3,6 +3,7 @@ package com.alops.system.service;
import com.alops.system.domain.EquBase;
import com.alops.system.domain.dto.EquBaseQueryDto;
import com.alops.system.domain.vo.dropDownVo;
import com.alops.system.domain.vo.equipmentAssessmentVo;
import com.alops.system.domain.vo.imageVo;
import com.alops.system.domain.dto.*;
import com.alops.system.domain.vo.queryEquBaseVO;
@ -18,7 +19,8 @@ import java.util.List;
*/
public interface IEquBaseService
{
//获取设备评估信息
public List<equipmentAssessmentVo> getDeviceIAssessmentnfo();
public List<dropDownVo> selectEquManu();
public List<dropDownVo> selectEquSupp();

@ -21,6 +21,8 @@ public interface IScheduleRulesService
public Boolean checkRunningOrWaitingRules();
public AjaxResult executeRule(ScheduleRules newRule) throws SchedulerException, ExecutionException, InterruptedException;
public int executeImmediately() throws ExecutionException, InterruptedException;

@ -2,7 +2,6 @@ package com.alops.system.service.impl;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -12,7 +11,7 @@ import com.alops.system.domain.dto.AlertDto;
import com.alops.system.domain.dto.AlertStatisticDto;
import com.alops.system.domain.dto.LevelCountDto;
import com.alops.system.domain.dto.TypeCountDto;
import com.alops.system.domain.vo.homeEquAlertMessage;
import com.alops.system.domain.vo.homeEquAlertMessageVo;
import com.alops.system.mapper.AlertMessageMapper;
import com.alops.system.service.IAlertMessageService;
import org.springframework.beans.factory.annotation.Autowired;
@ -55,7 +54,7 @@ public class AlertMessageServiceImpl implements IAlertMessageService
}
@Override
public List<homeEquAlertMessage> selectStaticAlertMessageList(){
public List<homeEquAlertMessageVo> selectStaticAlertMessageList(){
return alertMessageMapper.selectStaticAlertMessageList();
}

@ -1,14 +1,13 @@
package com.alops.system.service.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.math.BigDecimal;
import java.util.*;
import com.alops.common.utils.SecurityUtils;
import com.alops.system.domain.EquBase;
import com.alops.system.domain.dto.EquBaseQueryDto;
import com.alops.system.domain.vo.dropDownVo;
import com.alops.system.domain.vo.equipmentAssessmentVo;
import com.alops.system.domain.vo.imageVo;
import com.alops.system.domain.dto.*;
import com.alops.system.domain.vo.queryEquBaseVO;
@ -53,6 +52,54 @@ public class EquBaseServiceImpl implements IEquBaseService
return equSupplierMapper.selectEquSupDropDown();
}
//设备评估信息
@Override
public List<equipmentAssessmentVo> getDeviceIAssessmentnfo(){
List<equipmentAssessmentDto> equAsstDtoList = equBaseMapper.getEquipmentAssessmentList();
List<equipmentAssessmentVo> resultList = new ArrayList<>();
for (equipmentAssessmentDto dto : equAsstDtoList) {
equipmentAssessmentVo vo = new equipmentAssessmentVo();
vo.setId(dto.getId());
vo.setEquNumber(dto.getEquNumber());
vo.setName(dto.getName());
vo.setLocation(dto.getLocation());
vo.setEquType(dto.getEquType());
vo.setDeviceLevel(dto.getDeviceLevel());
// 四项指标
String cpuStatus = checkStatus(dto.getCpuUtilization(), 80, 90, 95);
String memoryStatus = checkStatus(dto.getMemoryUtilization(), 80, 90, 95);
String temperatureStatus = checkTemperatureStatus(dto.getTemperature());
String healthStatus = checkHealthStatus(dto.getHealth());
vo.setCpuStatus(cpuStatus);
vo.setMemoryStatus(memoryStatus);
vo.setTemperatureStatus(temperatureStatus);
vo.setHealthStatus(healthStatus);
// 风险等级 = 四项指标中最严重的
int riskLevel = Math.max(
Math.max(getRisk(cpuStatus), getRisk(memoryStatus)),
Math.max(getRisk(temperatureStatus), getRisk(healthStatus))
);
vo.setRiskGrade(switch (riskLevel) {
case 1 -> "无风险";
case 2 -> "低";
case 3 -> "中";
case 4 -> "高";
default -> "未知";
});
resultList.add(vo);
}
return resultList;
}
@Autowired
private EquInterfaceMapper interfaceMapper;
/**
@ -184,6 +231,49 @@ public class EquBaseServiceImpl implements IEquBaseService
return totalDeviceCount;
}
/** 通用百分比指标判断(CPU/内存) */
private String checkStatus(BigDecimal val, double healthy, double good, double average) {
if (val == null) return "未知";
double v = val.doubleValue();
if (v < healthy) return "健康";
if (v < good) return "良好";
if (v < average) return "一般";
return "需维护";
}
/** 温度判断 */
private String checkTemperatureStatus(BigDecimal temp) {
if (temp == null) return "未知";
double val = temp.doubleValue();
if (val >= 25 && val <= 45) return "健康";
if ((val >= 20 && val < 25) || (val > 45 && val <= 50)) return "良好";
if ((val >= 16 && val < 20) || (val > 50 && val <= 55)) return "一般";
return "需维护";
}
/** 健康度判断 */
private String checkHealthStatus(BigDecimal health) {
if (health == null) return "未知";
return switch (health.intValue()) {
case 1 -> "健康";
case 2 -> "良好";
case 3 -> "一般";
case 4 -> "需维护";
default -> "未知";
};
}
/** 风险等级映射:健康=1,良好=2,一般=3,需维护=4 */
private int getRisk(String status) {
return switch (status) {
case "健康" -> 1;
case "良好" -> 2;
case "一般" -> 3;
case "需维护" -> 4;
default -> 0;
};
}
/**
* 新增设备基本信息

@ -61,6 +61,19 @@ public class ScheduleRulesServiceImpl implements IScheduleRulesService {
private static final Logger log = LoggerFactory.getLogger(ScheduleRulesServiceImpl.class);
@Override
public Boolean checkRunningOrWaitingRules() {
List<ScheduleRules> runningOrWaiting = scheduleRulesMapper.selectListOne();
// 检查列表是否不为空且有数据
if (runningOrWaiting != null && !runningOrWaiting.isEmpty()) {
return true;
}
return false;
}
@Override
public AjaxResult executeRule(ScheduleRules newRule) throws SchedulerException, ExecutionException, InterruptedException {
@ -162,7 +175,7 @@ public class ScheduleRulesServiceImpl implements IScheduleRulesService {
Map<String, List<EquOid>> oidMap = new HashMap<>();
for (EquBase dev : devices) {
oidMap.put(dev.getManufacture(), equOidMapper.findByManuIdAndStatus(dev.getManufacture()));
oidMap.put(dev.getEquManuId(), equOidMapper.findByManuIdAndStatus(dev.getEquManuId()));
}
ExecutorService executor = Executors.newFixedThreadPool(10);
@ -171,7 +184,7 @@ public class ScheduleRulesServiceImpl implements IScheduleRulesService {
for (EquBase device : devices) {
futures.add(executor.submit(() -> {
long start = System.currentTimeMillis();
List<EquOid> oids = oidMap.getOrDefault(device.getManufacture(), Collections.emptyList());
List<EquOid> oids = oidMap.getOrDefault(device.getEquManuId(), Collections.emptyList());
Map<String, Object> snmpResults = snmpService.query(device.getIp(), oids);
long afterSnmp = System.currentTimeMillis();
System.out.println("SNMP查询耗时: " + (afterSnmp - start) + " ms");

@ -86,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<!-- 查询最新预警信息(按时间排序,取前N条) -->
<select id="selectStaticAlertMessageList" resultType="homeEquAlertMessage">
<select id="selectStaticAlertMessageList" resultType="homeEquAlertMessageVo">
SELECT
a.level,
a.occur_time AS occurTime,

@ -30,6 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<resultMap id="EquMonitorResult" type="com.alops.system.domain.vo.EquMonitorVO">
<result property="id" column="id" />
@ -87,6 +90,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<select id="getEquipmentAssessmentList"
resultType="com.alops.system.domain.dto.equipmentAssessmentDto">
SELECT
b.id AS id,
b.equ_number AS equNumber,
b.name AS name,
b.location AS location,
t.name AS equType, -- 从 equ_type 表取类型名称
b.device_level AS deviceLevel,
-- 从 equ_gather 最新一条记录中取数据
g.health AS health,
g.temperature AS temperature,
g.cpu_utilization AS cpuUtilization,
g.memory_utilization AS memoryUtilization
FROM equ_base b
LEFT JOIN equ_type t
ON b.equ_type = t.id
LEFT JOIN (
SELECT eg1.*
FROM equ_gather eg1
INNER JOIN (
SELECT equ_id, MAX(gather_time) AS max_time
FROM equ_gather
GROUP BY equ_id
) eg2
ON eg1.equ_id = eg2.equ_id AND eg1.gather_time = eg2.max_time
) g
ON b.id = g.equ_id
WHERE b.status = 1
ORDER BY b.id
</select>
<select id="findEquBaseList" resultMap="EquBaseResult">
<include refid="selectEquBaseVo"/>
<where>
@ -101,9 +143,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.name AS name,
b.version AS version,
b.ip AS ip,
m.name AS manuName,
b.manufacture AS equManuId,
m.name AS manufacture,
b.supplier_id AS supplierId,
s.name AS supplierName,
b.location AS location,
b.equ_type AS equTypeId,
t.name AS equType,
b.in_charge AS inCharge,
b.install_date AS installDate,
@ -378,9 +423,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="name != null">name,</if>
<if test="version != null">version,</if>
<if test="ip != null">ip,</if>
<if test="manufacture != null">manufacture,</if>
<if test="equManuId != null">manufacture,</if>
<if test="location != null">location,</if>
<if test="equType != null">equ_type,</if>
<if test="equTypeId != null">equ_type,</if>
<if test="inCharge != null">in_charge,</if>
<if test="installDate != null">install_date,</if>
<if test="lifeCycle != null">life_cycle,</if>
@ -401,9 +446,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="name != null">#{name},</if>
<if test="version != null">#{version},</if>
<if test="ip != null">#{ip},</if>
<if test="manufacture != null">#{manufacture},</if>
<if test="equManuId != null">#{equManuId},</if>
<if test="location != null">#{location},</if>
<if test="equType != null">#{equType},</if>
<if test="equTypeId != null">#{equTypeId},</if>
<if test="inCharge != null">#{inCharge},</if>
<if test="installDate != null">#{installDate},</if>
<if test="lifeCycle != null">#{lifeCycle},</if>
@ -427,9 +472,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="name != null">name = #{name},</if>
<if test="version != null">version = #{version},</if>
<if test="ip != null">ip = #{ip},</if>
<if test="manufacture != null">manufacture = #{manufacture},</if>
<if test="equManuId != null">manufacture = #{equManuId},</if>
<if test="location != null">location = #{location},</if>
<if test="equType != null">equ_type = #{equType},</if>
<if test="equTypeId != null">equ_type = #{equTypeId},</if>
<if test="inCharge != null">in_charge = #{inCharge},</if>
<if test="installDate != null">install_date = #{installDate},</if>
<if test="lifeCycle != null">life_cycle = #{lifeCycle},</if>

@ -49,6 +49,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectListOne" resultMap="ScheduleRulesResult">
SELECT *
FROM schedule_rules
WHERE status = 1
</select>
<select id="selectScheduleRulesList" parameterType="ScheduleRules" resultMap="ScheduleRulesResult">
<include refid="selectScheduleRulesVo"/>
<where>

Loading…
Cancel
Save