使用mybatisplus自带拼接类方法代替xml的持久层接口

This commit is contained in:
zhangjunwen 2024-10-11 16:34:40 +08:00
parent 75daa51e90
commit f33f54e75d
27 changed files with 706 additions and 157 deletions

View File

@ -6,6 +6,7 @@ import com.inspur.module.data.service.InfluxDBService;
import com.inspur.module.system.api.alarm.AlarmRulesApi;
import com.inspur.module.system.api.alarm.dto.AlarmRulesRespDTO;
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDO;
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDetailsDTO;
import com.inspur.module.system.service.gatewayinfo.GatewayInfoService;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
@ -139,7 +140,7 @@ public class MyMqttCallback implements MqttCallback {
*/
private Map<String, Object> getGatewayMapping(String gatewayCode) {
GatewayInfoService gatewayInfoService = SpringUtils.getBean(GatewayInfoService.class);
GatewayInfoDO gatewayInfo = gatewayInfoService.getGatewayInfoByGatewayCode(gatewayCode);
GatewayInfoDetailsDTO gatewayInfo = gatewayInfoService.getGatewayInfoByGatewayCode(gatewayCode);
if(gatewayInfo == null){
return null;
}

View File

@ -11,6 +11,7 @@ import com.inspur.module.system.controller.equip.vo.EquipInfoSaveReqVO;
import com.inspur.module.system.dal.dataobject.alarm.AlarmDataDO;
import com.inspur.module.system.dal.dataobject.alarm.AlarmDataDTO;
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDO;
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDTO;
import com.inspur.module.system.service.alarm.AlarmDataService;
import com.inspur.module.system.service.alarm.AlarmRulesService;
import com.inspur.module.system.service.alarm.EquipAlarmDataService;
@ -169,7 +170,7 @@ public class AlarmRulesApiImpl implements AlarmRulesApi{
*/
private String refreshEquipAlarmData(AlarmRulesRespDTO rule){
//TODO 查询时要查询趋势报警信息
List<EquipAlarmDataDO> equipAlarmData = equipAlarmDataService.getEquipAlarmDataByEquipId(rule.getEquipId(),0);
List<EquipAlarmDataDTO> equipAlarmData = equipAlarmDataService.getEquipAlarmDataByEquipId(rule.getEquipId(),0);
if(equipAlarmData == null || equipAlarmData.size() == 0){
return equipAlarmDataService.createEquipAlarmData(new EquipAlarmDataSaveReqVO(null,rule.getEquipId(),
rule.getComponentId(),rule.getAlarmLevel(),0,LocalDateTime.now(),LocalDateTime.now(),0,null));
@ -188,7 +189,7 @@ public class AlarmRulesApiImpl implements AlarmRulesApi{
*/
private String changeEquipStatusByRule(AlarmRulesRespDTO rule){
List<EquipAlarmDataDO> equipAlarmData = equipAlarmDataService.getEquipAlarmDataByEquipId(rule.getEquipId(),null);
List<EquipAlarmDataDTO> equipAlarmData = equipAlarmDataService.getEquipAlarmDataByEquipId(rule.getEquipId(),null);
if(equipAlarmData == null || equipAlarmData.size() == 0){
return equipAlarmDataService.createEquipAlarmData(new EquipAlarmDataSaveReqVO(null,rule.getEquipId(),
rule.getComponentId(),rule.getAlarmLevel(),1,LocalDateTime.now(),LocalDateTime.now(),0,judgeEquipAnalyzeStatusByAlarmLevel(rule.getAlarmLevel())));

View File

@ -1,5 +1,6 @@
package com.inspur.module.system.controller.admin.alarm;
import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDTO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -56,7 +57,7 @@ public class AlarmRulesController {
@Operation(summary = "改变报警规则状态")
@PreAuthorize("@ss.hasPermission('imt:alarm-rules:change')")
public CommonResult<Boolean> changeAlarmRulesStatus(@Valid @RequestBody AlarmRulesSaveReqVO updateReqVO) {
AlarmRulesDO alarmRules = alarmRulesService.getAlarmRules(updateReqVO.getAlarmId());
AlarmRulesDTO alarmRules = alarmRulesService.getAlarmRules(updateReqVO.getAlarmId());
updateReqVO.setStatus(alarmRules.getStatus() == 0 ? 1 : 0);
alarmRulesService.updateAlarmRules(updateReqVO);
return success(true);
@ -76,7 +77,7 @@ public class AlarmRulesController {
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('imt:alarm-rules:query')")
public CommonResult<AlarmRulesRespVO> getAlarmRules(@RequestParam("id") String id) {
AlarmRulesDO alarmRules = alarmRulesService.getAlarmRules(id);
AlarmRulesDTO alarmRules = alarmRulesService.getAlarmRules(id);
return success(BeanUtils.toBean(alarmRules, AlarmRulesRespVO.class));
}
@ -84,7 +85,7 @@ public class AlarmRulesController {
@Operation(summary = "获得机床报警规则分页")
@PreAuthorize("@ss.hasPermission('imt:alarm-rules:query')")
public CommonResult<PageResult<AlarmRulesRespVO>> getAlarmRulesPage(@Valid AlarmRulesPageReqVO pageReqVO) {
PageResult<AlarmRulesDO> pageResult = alarmRulesService.getAlarmRulesPage(pageReqVO);
PageResult<AlarmRulesDTO> pageResult = alarmRulesService.getAlarmRulesPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, AlarmRulesRespVO.class));
}
@ -95,7 +96,7 @@ public class AlarmRulesController {
public void exportAlarmRulesExcel(@Valid AlarmRulesPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<AlarmRulesDO> list = alarmRulesService.getAlarmRulesPage(pageReqVO).getList();
List<AlarmRulesDTO> list = alarmRulesService.getAlarmRulesPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "机床报警规则.xls", "数据", AlarmRulesRespVO.class,
BeanUtils.toBean(list, AlarmRulesRespVO.class));

View File

@ -1,6 +1,7 @@
package com.inspur.module.system.controller.admin.alarm;
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDTO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -72,7 +73,7 @@ public class EquipAlarmDataController {
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('imt:equip-alarm-data:query')")
public CommonResult<EquipAlarmDataRespVO> getEquipAlarmData(@RequestParam("id") String id) {
EquipAlarmDataDO equipAlarmData = equipAlarmDataService.getEquipAlarmData(id);
EquipAlarmDataDTO equipAlarmData = equipAlarmDataService.getEquipAlarmData(id);
return success(BeanUtils.toBean(equipAlarmData, EquipAlarmDataRespVO.class));
}
@ -80,7 +81,7 @@ public class EquipAlarmDataController {
@Operation(summary = "获得机床设备报警数据分页")
@PreAuthorize("@ss.hasPermission('imt:equip-alarm-data:query')")
public CommonResult<PageResult<EquipAlarmDataRespVO>> getEquipAlarmDataPage(@Valid EquipAlarmDataPageReqVO pageReqVO) {
PageResult<EquipAlarmDataDO> pageResult = equipAlarmDataService.getEquipAlarmDataPage(pageReqVO);
PageResult<EquipAlarmDataDTO> pageResult = equipAlarmDataService.getEquipAlarmDataPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, EquipAlarmDataRespVO.class));
}
@ -91,7 +92,7 @@ public class EquipAlarmDataController {
public void exportEquipAlarmDataExcel(@Valid EquipAlarmDataPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<EquipAlarmDataDO> list = equipAlarmDataService.getEquipAlarmDataPage(pageReqVO).getList();
List<EquipAlarmDataDTO> list = equipAlarmDataService.getEquipAlarmDataPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "机床设备报警数据.xls", "数据", EquipAlarmDataRespVO.class,
BeanUtils.toBean(list, EquipAlarmDataRespVO.class));
@ -100,7 +101,7 @@ public class EquipAlarmDataController {
@Operation(summary = "获取报警提交维修工单详情")
@GetMapping("/getSubmitOrderDetails/{alarmId}")
@PreAuthorize("@ss.hasPermission('imt:equip-alarm-data:query')")
public CommonResult<AlarmSubmitOrderDetailsVO> getSubmitOrderDetails(@PathVariable("alarmId") String alarmId) {
public CommonResult<EquipAlarmDataDTO> getSubmitOrderDetails(@PathVariable("alarmId") String alarmId) {
return success(equipAlarmDataService.getSubmitOrderDetails(alarmId));
}

View File

@ -1,5 +1,6 @@
package com.inspur.module.system.controller.admin.gatewayinfo;
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDetailsDTO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -10,7 +11,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
@ -71,7 +71,7 @@ public class GatewayInfoController {
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('imt:gateway-info:query')")
public CommonResult<GatewayInfoRespVO> getGatewayInfo(@RequestParam("id") String id) {
GatewayInfoDO gatewayInfo = gatewayInfoService.getGatewayInfo(id);
GatewayInfoDetailsDTO gatewayInfo = gatewayInfoService.getGatewayInfo(id);
return success(BeanUtils.toBean(gatewayInfo, GatewayInfoRespVO.class));
}
@ -79,7 +79,7 @@ public class GatewayInfoController {
@Operation(summary = "获得机床网关信息分页")
@PreAuthorize("@ss.hasPermission('imt:gateway-info:query')")
public CommonResult<PageResult<GatewayInfoRespVO>> getGatewayInfoPage(@Valid GatewayInfoPageReqVO pageReqVO) {
PageResult<GatewayInfoDO> pageResult = gatewayInfoService.getGatewayInfoPage(pageReqVO);
PageResult<GatewayInfoDetailsDTO> pageResult = gatewayInfoService.getGatewayInfoPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, GatewayInfoRespVO.class));
}
@ -90,7 +90,7 @@ public class GatewayInfoController {
public void exportGatewayInfoExcel(@Valid GatewayInfoPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<GatewayInfoDO> list = gatewayInfoService.getGatewayInfoPage(pageReqVO).getList();
List<GatewayInfoDetailsDTO> list = gatewayInfoService.getGatewayInfoPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "机床网关信息.xls", "数据", GatewayInfoRespVO.class,
BeanUtils.toBean(list, GatewayInfoRespVO.class));

View File

@ -96,6 +96,11 @@ public class AlarmDataDTO {
*/
private String equipNo;
/**
* 设备名称
*/
private String equipName;
/**
* 组件名称
*/

View File

@ -89,10 +89,4 @@ public class AlarmRulesDO extends BaseDO {
* 排序
*/
private Integer sort;
private String equipNo;
private String customerName;
private String componentName;
}

View File

@ -0,0 +1,106 @@
package com.inspur.module.system.dal.dataobject.alarm;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.math.BigDecimal;
/**
* @Author zhangjunwen
* @create 2024/10/11
*/
@Data
public class AlarmRulesDTO {
/**
* 报警规则信息id
*/
@TableId(type = IdType.ASSIGN_UUID)
private String alarmId;
/**
* 报警信息的key
*/
private String alarmNameKey;
/**
* 报警规则信息名称
*/
private String alarmName;
/**
* 报警规则信息单位
*/
private String alarmInfoUnit;
/**
* 机床设备id
*/
private String equipId;
/**
* 机床组件id
*/
private String componentId;
/**
* 报警规则上限值
*/
private BigDecimal alertUpperBound;
/**
* 报警规则下限值
*/
private BigDecimal alertLowerBound;
/**
* 报警规则信息的类型0阈值报警1趋势报警
*/
private Integer type;
/**
* 状态0启用1停用
*/
private Integer status;
/**
* 报警可能原因描述
*/
private String reasonDescription;
/**
* 备注
*/
private String remark;
/**
* 规则描述
*/
private String referenceName;
/**
* 判断规则
*/
private String referenceCon;
/**
* 等级
*/
private Integer alarmLevel;
/**
* 排序
*/
private Integer sort;
/**
* 设备编号
*/
private String equipNo;
/**
* 设备型号
*/
private String modelName;
/**
* 设备名称
*/
private String equipName;
/**
* 客户名
*/
private String customerName;
/**
* 组件名
*/
private String componentName;
}

View File

@ -62,23 +62,4 @@ public class EquipAlarmDataDO extends BaseDO {
*/
private Integer equipAnalyseStatus;
/**
* 客户名
*/
private String customerName;
/**
* 设备编号
*/
private String equipNo;
/**
* 设备型号
*/
private String modelName;
/**
* 组件名
*/
private String componentName;
}

View File

@ -0,0 +1,76 @@
package com.inspur.module.system.dal.dataobject.alarm;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @Author zhangjunwen
* @create 2024/10/11
*/
@Data
public class EquipAlarmDataDTO {
private String equipAlarmId;
/**
* 机床设备id
*/
private String equipId;
/**
* 机床组件id
*/
private String componentId;
/**
* 报警等级11级22级33级
* <p>
* 枚举 {@link TODO alarm_level 对应的类}
*/
private Integer alarmLevel;
/**
* 报警类型0阈值报警 1趋势报警
*/
private Integer alarmType;
/**
* 首次报警时间
*/
private LocalDateTime firstAlarmTime;
/**
* 最新报警时间
*/
private LocalDateTime latestAlarmTime;
/**
* 状态0:待处理1已处理
*/
private Integer status;
/**
* 机床分析状态0正常1磨损中2磨损严重
*/
private Integer equipAnalyseStatus;
/**
* 客户名
*/
private String customerName;
/**
* 设备编号
*/
private String equipNo;
/**
* 设备名称
*/
private String equipName;
/**
* 设备型号
*/
private String modelName;
/**
* 组件名
*/
private String componentName;
}

View File

@ -78,18 +78,4 @@ public class GatewayInfoDO extends BaseDO {
*/
private String gatewayCode;
/**
* 客户名称
*/
private String customerName;
/**
* 设备编号
*/
private String equipNo;
/**
* 机床型号
*/
private String modelName;
}

View File

@ -0,0 +1,86 @@
package com.inspur.module.system.dal.dataobject.gatewayinfo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
* @Author zhangjunwen
* @create 2024/10/10
*/
@Data
public class GatewayInfoDetailsDTO {
/**
* 机床网关id
*/
@TableId(type = IdType.ASSIGN_UUID)
private String gatewayId;
/**
* 机床网关名称
*/
private String gatewayName;
/**
* 机床网关型号
*/
private String gatewayModel;
/**
* 机床网关生产厂商
*/
private String gatewayMfg;
/**
* 机床网关位置
*/
private String gatewayLocation;
/**
* 固件版本
*/
private String firmwareVersion;
/**
* ip地址
*/
private String ipAddress;
/**
* 规格参数
*/
private String gatewaySpn;
/**
* 状态0正常1异常2停机
* <p>
*/
private Integer status;
/**
* 备注
*/
private String remark;
/**
* 网关图片路径
*/
private String gatewayPicPath;
/**
* 设备id
*/
private String equipId;
/**
* 网关编号
*/
private String gatewayCode;
/**
* 客户名称
*/
private String customerName;
/**
* 设备编号
*/
private String equipNo;
/**
* 机床型号
*/
private String modelName;
}

View File

@ -8,11 +8,17 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.inspur.framework.mybatis.core.mapper.BaseMapperX;
import com.inspur.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.inspur.framework.tenant.core.aop.TenantIgnore;
import com.inspur.module.system.controller.imtIndex.vo.ImtIndexAlarmListVO;
import com.inspur.module.system.dal.dataobject.alarm.AlarmDataDO;
import com.inspur.module.system.dal.dataobject.alarm.AlarmDataDTO;
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDO;
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDTO;
import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO;
import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO;
import com.inspur.module.system.dal.dataobject.equip.ComponentInfoDO;
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
import org.apache.ibatis.annotations.Mapper;
import com.inspur.module.system.controller.admin.alarm.vo.*;
import org.apache.ibatis.annotations.Param;
@ -64,17 +70,90 @@ public interface AlarmDataMapper extends BaseMapperX<AlarmDataDO> {
}
/**
* 分页查询参数报警列表
*/
default PageResult<AlarmDataDTO> selectAlarmDataDetailsList(AlarmDataPageReqVO reqVO) {
MPJLambdaWrapperX<AlarmDataDO> wrapper = new MPJLambdaWrapperX<>();
wrapper.selectAll(AlarmDataDO.class)
.selectAs(EquipInfoDO::getEquipNo, AlarmDataDTO::getEquipNo)
.selectAs(EquipInfoDO::getEquipName, AlarmDataDTO::getEquipName)
.selectAs(ModelInfoDO::getModelName, AlarmDataDTO::getModelName)
.selectAs(CustomerInfoDO::getCustomerName, AlarmDataDTO::getCustomerName)
.selectAs(ComponentInfoDO::getComponentName, AlarmDataDTO::getComponentName)
.leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, AlarmDataDO::getEquipId)
.leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId)
.leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId)
.leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, AlarmDataDO::getComponentId)
.eq(AlarmDataDO::getStatus, 0)
.eqIfExists(AlarmDataDO::getAlarmRulesId, reqVO.getAlarmRulesId())
.eqIfExists(AlarmDataDO::getEquipId, reqVO.getEquipId())
.eqIfExists(AlarmDataDO::getComponentId, reqVO.getComponentId())
.eqIfExists(AlarmDataDO::getNameKey, reqVO.getNameKey())
.eqIfExists(AlarmDataDO::getAlarmType, reqVO.getAlarmType())
.orderByDesc(AlarmDataDO::getCreateTime);
if(Objects.nonNull(reqVO.getFirstAlarmTime())){
wrapper.geIfExists(AlarmDataDO::getFirstAlarmTime, reqVO.getFirstAlarmTime()[0])
.leIfExists(AlarmDataDO::getFirstAlarmTime, reqVO.getFirstAlarmTime()[1]);
}
if(Objects.nonNull(reqVO.getLastAlarmTime())){
wrapper.geIfExists(AlarmDataDO::getLastAlarmTime, reqVO.getLastAlarmTime()[0])
.leIfExists(AlarmDataDO::getLastAlarmTime, reqVO.getLastAlarmTime()[1]);
}
return selectJoinPage(reqVO, AlarmDataDTO.class, wrapper);
}
/**
* 查询参数报警列表
*/
public IPage<AlarmDataDTO> selectAlarmDataList(IPage<AlarmDataDTO> page, @Param("reqVO") AlarmDataPageReqVO reqVO);
/**
* 根据id查询参数报警详情
*/
default AlarmDataDTO selectAlarmDataDetailsById(Long id){
return selectJoinOne(AlarmDataDTO.class, new MPJLambdaWrapperX<AlarmDataDO>()
.selectAll(AlarmDataDO.class)
.selectAs(EquipInfoDO::getEquipNo, AlarmDataDTO::getEquipNo)
.selectAs(EquipInfoDO::getEquipName, AlarmDataDTO::getEquipName)
.selectAs(ModelInfoDO::getModelName, AlarmDataDTO::getModelName)
.selectAs(CustomerInfoDO::getCustomerName, AlarmDataDTO::getCustomerName)
.selectAs(ComponentInfoDO::getComponentName, AlarmDataDTO::getComponentName)
.leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, AlarmDataDO::getEquipId)
.leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId)
.leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId)
.leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, AlarmDataDO::getComponentId)
.eq(AlarmDataDO::getStatus, 0)
.eq(AlarmDataDO::getAlarmDataId, id)
);
}
/**
* 根据id查询参数报警
*/
@TenantIgnore
public AlarmDataDTO selectAlarmDataById(@Param("id") Long id);
/**
* 根据规则id查询参数报警
*/
default AlarmDataDTO selectAlarmDataListByRulesId(@Param("alarmRulesId") String alarmRulesId) {
return selectJoinOne(AlarmDataDTO.class, new MPJLambdaWrapperX<AlarmDataDO>()
.selectAll(AlarmDataDO.class)
.selectAs(EquipInfoDO::getEquipNo, AlarmDataDTO::getEquipNo)
.selectAs(EquipInfoDO::getEquipName, AlarmDataDTO::getEquipName)
.selectAs(ModelInfoDO::getModelName, AlarmDataDTO::getModelName)
.selectAs(CustomerInfoDO::getCustomerName, AlarmDataDTO::getCustomerName)
.selectAs(ComponentInfoDO::getComponentName, AlarmDataDTO::getComponentName)
.leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, AlarmDataDO::getEquipId)
.leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId)
.leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId)
.leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, AlarmDataDO::getComponentId)
.eq(AlarmDataDO::getStatus, 0)
.eq(AlarmDataDO::getAlarmRulesId, alarmRulesId)
);
}
/**
* 根据规则id查询参数报警
*/

View File

@ -4,7 +4,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.inspur.framework.mybatis.core.mapper.BaseMapperX;
import com.inspur.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.inspur.module.system.controller.admin.gatewayinfo.vo.GatewayInfoPageReqVO;
import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDO;
import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDTO;
import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO;
import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO;
import com.inspur.module.system.dal.dataobject.equip.ComponentInfoDO;
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDO;
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDetailsDTO;
import org.apache.ibatis.annotations.Mapper;
import com.inspur.module.system.controller.admin.alarm.vo.*;
import org.apache.ibatis.annotations.Param;
@ -40,16 +49,74 @@ public interface AlarmRulesMapper extends BaseMapperX<AlarmRulesDO> {
.orderByDesc(AlarmRulesDO::getAlarmId));
}
/**
* 分页查询设备报警规则列表
*/
default PageResult<AlarmRulesDTO> selectAlarmRulesDetailsList(@Param("reqVO") AlarmRulesPageReqVO reqVO) {
return selectJoinPage(reqVO, AlarmRulesDTO.class, new MPJLambdaWrapperX<AlarmRulesDO>()
.selectAll(AlarmRulesDO.class)
.selectAs(EquipInfoDO::getEquipNo, AlarmRulesDTO::getEquipNo)
.selectAs(EquipInfoDO::getEquipName, AlarmRulesDTO::getEquipName)
.selectAs(ModelInfoDO::getModelName, AlarmRulesDTO::getModelName)
.selectAs(CustomerInfoDO::getCustomerName, AlarmRulesDTO::getCustomerName)
.selectAs(ComponentInfoDO::getComponentName, AlarmRulesDTO::getComponentName)
.leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, AlarmRulesDO::getEquipId)
.leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId)
.leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId)
.leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, AlarmRulesDO::getComponentId)
.eqIfExists(AlarmRulesDO::getEquipId, reqVO.getEquipId())
.eqIfExists(AlarmRulesDO::getType, reqVO.getType())
.eqIfExists(AlarmRulesDO::getAlarmLevel, reqVO.getAlarmLevel())
.likeIfExists(AlarmRulesDO::getAlarmName, reqVO.getAlarmName())
.likeIfExists(AlarmRulesDO::getAlarmNameKey, reqVO.getAlarmNameKey())
);
}
/**
* 查询设备报警规则列表
*/
public IPage<AlarmRulesDO> selectAlarmRulesList(IPage<AlarmRulesDO> page, @Param("reqVO") AlarmRulesPageReqVO reqVO);
/**
* 根据id查询报警规则信息
*/
default AlarmRulesDTO selectAlarmRulesDetailsById(String id){
return selectJoinOne(AlarmRulesDTO.class,new MPJLambdaWrapperX<AlarmRulesDO>()
.selectAll(AlarmRulesDO.class)
.selectAs(EquipInfoDO::getEquipNo, AlarmRulesDTO::getEquipNo)
.selectAs(ModelInfoDO::getModelName, AlarmRulesDTO::getModelName)
.selectAs(CustomerInfoDO::getCustomerName, AlarmRulesDTO::getCustomerName)
.leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, AlarmRulesDO::getEquipId)
.leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId)
.leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId)
.eq(AlarmRulesDO::getAlarmId, id)
);
}
/**
* 根据id查询报警规则
*/
public AlarmRulesDO selectAlarmRulesById(@Param("id") String id);
/**
* 根据设备id查询报警规则
*/
default List<AlarmRulesDTO> getAlarmRulesDetailsListByEquipId(String equipId){
return selectJoinList(AlarmRulesDTO.class,new MPJLambdaWrapperX<AlarmRulesDO>()
.selectAll(AlarmRulesDO.class)
.selectAs(EquipInfoDO::getEquipNo, AlarmRulesDTO::getEquipNo)
.selectAs(EquipInfoDO::getEquipName, AlarmRulesDTO::getEquipName)
.selectAs(ModelInfoDO::getModelName, AlarmRulesDTO::getModelName)
.selectAs(CustomerInfoDO::getCustomerName, AlarmRulesDTO::getCustomerName)
.selectAs(ComponentInfoDO::getComponentName, AlarmRulesDTO::getComponentName)
.leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, AlarmRulesDO::getEquipId)
.leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId)
.leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId)
.leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, AlarmRulesDO::getComponentId)
.eq(AlarmRulesDO::getStatus, 0)
.eq(AlarmRulesDO::getEquipId, equipId)
);
}
/**
* 根据设备id查询报警规则
*/

View File

@ -4,8 +4,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.inspur.framework.mybatis.core.mapper.BaseMapperX;
import com.inspur.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDO;
import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDTO;
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDO;
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDTO;
import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO;
import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO;
import com.inspur.module.system.dal.dataobject.equip.ComponentInfoDO;
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
import org.apache.ibatis.annotations.Mapper;
import com.inspur.module.system.controller.admin.alarm.vo.*;
import org.apache.ibatis.annotations.Param;
@ -33,22 +40,95 @@ public interface EquipAlarmDataMapper extends BaseMapperX<EquipAlarmDataDO> {
.orderByDesc(EquipAlarmDataDO::getEquipAlarmId));
}
/**
* 分页查询设备报警列表
*/
default PageResult<EquipAlarmDataDTO> selectEquipAlarmDetailsList(@Param("reqVO") EquipAlarmDataPageReqVO reqVO) {
MPJLambdaWrapperX<EquipAlarmDataDO> wrapper = new MPJLambdaWrapperX<>();
wrapper.selectAll(EquipAlarmDataDO.class)
.selectAs(EquipInfoDO::getEquipNo, EquipAlarmDataDTO::getEquipNo)
.selectAs(EquipInfoDO::getEquipName, EquipAlarmDataDTO::getEquipName)
.selectAs(ModelInfoDO::getModelName, EquipAlarmDataDTO::getModelName)
.selectAs(CustomerInfoDO::getCustomerName, EquipAlarmDataDTO::getCustomerName)
.selectAs(ComponentInfoDO::getComponentName, EquipAlarmDataDTO::getComponentName)
.leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, EquipAlarmDataDO::getEquipId)
.leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId)
.leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId)
.leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, EquipAlarmDataDO::getComponentId)
.eq(EquipAlarmDataDO::getStatus, 0)
.eqIfExists(EquipAlarmDataDO::getEquipId, reqVO.getEquipId())
.eqIfExists(EquipAlarmDataDO::getComponentId, reqVO.getComponentId())
.eqIfExists(EquipAlarmDataDO::getAlarmLevel, reqVO.getAlarmLevel())
.eqIfExists(EquipAlarmDataDO::getAlarmType, reqVO.getAlarmType())
.orderByDesc(EquipAlarmDataDO::getFirstAlarmTime);
if(reqVO.getFirstAlarmTime() != null){
wrapper.geIfExists(EquipAlarmDataDO::getFirstAlarmTime, reqVO.getFirstAlarmTime()[0])
.leIfExists(EquipAlarmDataDO::getFirstAlarmTime, reqVO.getFirstAlarmTime()[1]);
}
return selectJoinPage(reqVO, EquipAlarmDataDTO.class, wrapper);
}
/**
* 查询设备报警列表
*/
public IPage<EquipAlarmDataDO> selectEquipAlarmList(IPage<EquipAlarmDataDO> page, @Param("reqVO") EquipAlarmDataPageReqVO reqVO);
/**
* 根据id查询设备报警信息
*/
default EquipAlarmDataDTO selectEquipAlarmDetailsById(String id){
return selectJoinOne(EquipAlarmDataDTO.class,new MPJLambdaWrapperX<EquipAlarmDataDO>()
.selectAll(EquipAlarmDataDO.class)
.selectAs(EquipInfoDO::getEquipNo, EquipAlarmDataDTO::getEquipNo)
.selectAs(EquipInfoDO::getEquipName, EquipAlarmDataDTO::getEquipName)
.selectAs(ModelInfoDO::getModelName, EquipAlarmDataDTO::getModelName)
.selectAs(CustomerInfoDO::getCustomerName, EquipAlarmDataDTO::getCustomerName)
.selectAs(ComponentInfoDO::getComponentName, EquipAlarmDataDTO::getComponentName)
.leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, EquipAlarmDataDO::getEquipId)
.leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId)
.leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId)
.leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, EquipAlarmDataDO::getComponentId)
.eq(EquipAlarmDataDO::getEquipAlarmId, id)
);
}
/**
* 根据id查询设备报警
*/
public EquipAlarmDataDO selectEquipAlarmById(@Param("id") String id);
/**
* 通过设备id查询设备报警列表
*/
default List<EquipAlarmDataDTO> getEquipAlarmDataDetailsByEquipIdAndAlarmType(@Param("equipId") String equipId,
@Param("alarmType") Integer alarmType){
return selectJoinList(EquipAlarmDataDTO.class,new MPJLambdaWrapperX<EquipAlarmDataDO>()
.selectAll(EquipAlarmDataDO.class)
.selectAs(EquipInfoDO::getEquipNo, EquipAlarmDataDTO::getEquipNo)
.selectAs(EquipInfoDO::getEquipName, EquipAlarmDataDTO::getEquipName)
.selectAs(ModelInfoDO::getModelName, EquipAlarmDataDTO::getModelName)
.selectAs(CustomerInfoDO::getCustomerName, EquipAlarmDataDTO::getCustomerName)
.selectAs(ComponentInfoDO::getComponentName, EquipAlarmDataDTO::getComponentName)
.leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, EquipAlarmDataDO::getEquipId)
.leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId)
.leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId)
.leftJoin(ComponentInfoDO.class, ComponentInfoDO::getComponentId, EquipAlarmDataDO::getComponentId)
.eq(EquipAlarmDataDO::getEquipId, equipId)
.eq(EquipAlarmDataDO::getAlarmType, alarmType)
);
}
/**
* 通过设备id查询设备报警数据
*/
List<EquipAlarmDataDO> getEquipAlarmDataByEquipIdAndAlarmType(@Param("equipId") String equipId,
@Param("alarmType") Integer alarmType);
/**
* 获取报警提交维修工单详情
*/
/**
* 获取报警提交维修工单详情
*

View File

@ -6,9 +6,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.inspur.framework.mybatis.core.mapper.BaseMapperX;
import com.inspur.module.system.controller.admin.alarm.vo.EquipAlarmDataPageReqVO;
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDO;
import com.inspur.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO;
import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO;
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDO;
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDetailsDTO;
import org.apache.ibatis.annotations.Mapper;
import com.inspur.module.system.controller.admin.gatewayinfo.vo.*;
import org.apache.ibatis.annotations.Param;
@ -29,21 +32,82 @@ public interface GatewayInfoMapper extends BaseMapperX<GatewayInfoDO> {
.orderByDesc(GatewayInfoDO::getGatewayId));
}
/**
* 联合查询网关信息列表
*/
default PageResult<GatewayInfoDetailsDTO> selectGatewayDetailsList(@Param("reqVO") GatewayInfoPageReqVO reqVO) {
return selectJoinPage(reqVO, GatewayInfoDetailsDTO.class, new MPJLambdaWrapperX<GatewayInfoDO>()
.selectAll(GatewayInfoDO.class)
.selectAs(EquipInfoDO::getEquipNo, GatewayInfoDetailsDTO::getEquipNo)
.selectAs(ModelInfoDO::getModelName, GatewayInfoDetailsDTO::getModelName)
.selectAs(CustomerInfoDO::getCustomerName, GatewayInfoDetailsDTO::getCustomerName)
.leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, GatewayInfoDO::getEquipId)
.leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId)
.leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId)
.eqIfExists(GatewayInfoDO::getEquipId, reqVO.getEquipId())
.likeIfExists(GatewayInfoDO::getGatewayName, reqVO.getGatewayName())
.likeIfExists(GatewayInfoDO::getGatewayModel, reqVO.getGatewayModel())
.likeIfExists(GatewayInfoDO::getGatewayCode, reqVO.getGatewayCode())
);
}
/**
* 查询网关信息列表
*/
public IPage<GatewayInfoDO> selectGatewayList(IPage<GatewayInfoDO> page, @Param("reqVO") GatewayInfoPageReqVO reqVO);
/**
* 根据id查询网关信息
*/
default GatewayInfoDetailsDTO selectGatewayDetailsById(String id){
return selectJoinOne(GatewayInfoDetailsDTO.class,new MPJLambdaWrapperX<GatewayInfoDO>()
.selectAll(GatewayInfoDO.class)
.selectAs(EquipInfoDO::getEquipNo, GatewayInfoDetailsDTO::getEquipNo)
.selectAs(ModelInfoDO::getModelName, GatewayInfoDetailsDTO::getModelName)
.selectAs(CustomerInfoDO::getCustomerName, GatewayInfoDetailsDTO::getCustomerName)
.leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, GatewayInfoDO::getEquipId)
.leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId)
.leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId)
.eq(GatewayInfoDO::getGatewayId, id)
);
}
public GatewayInfoDO selectGatewayById(@Param("id") String id);
/**
* 根据网关编号查询网关信息
*/
default GatewayInfoDetailsDTO selectGatewayDetailsByGatewayCode(String gatewayCode){
return selectJoinOne(GatewayInfoDetailsDTO.class,new MPJLambdaWrapperX<GatewayInfoDO>()
.selectAll(GatewayInfoDO.class)
.selectAs(EquipInfoDO::getEquipNo, GatewayInfoDetailsDTO::getEquipNo)
.selectAs(ModelInfoDO::getModelName, GatewayInfoDetailsDTO::getModelName)
.selectAs(CustomerInfoDO::getCustomerName, GatewayInfoDetailsDTO::getCustomerName)
.leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, GatewayInfoDO::getEquipId)
.leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId)
.leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId)
.eq(GatewayInfoDO::getGatewayCode, gatewayCode)
.eq(GatewayInfoDO::getStatus, 0)
);
}
/**
* 根据网关编号查询网关信息
*/
public GatewayInfoDO selectGatewayByGatewayCode(@Param("gatewayCode") String gatewayCode);
/**
* 获取网关信息列表
*/
default List<GatewayInfoDetailsDTO> selectAllGatewayDetailsList(){
return selectJoinList(GatewayInfoDetailsDTO.class,new MPJLambdaWrapperX<GatewayInfoDO>()
.selectAll(GatewayInfoDO.class)
.selectAs(EquipInfoDO::getEquipNo, GatewayInfoDetailsDTO::getEquipNo)
.selectAs(ModelInfoDO::getModelName, GatewayInfoDetailsDTO::getModelName)
.selectAs(CustomerInfoDO::getCustomerName, GatewayInfoDetailsDTO::getCustomerName)
.leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, GatewayInfoDO::getEquipId)
.leftJoin(ModelInfoDO.class, ModelInfoDO::getModelId, EquipInfoDO::getModelId)
.leftJoin(CustomerInfoDO.class, CustomerInfoDO::getCustomerId, EquipInfoDO::getCustomerId)
);
}
/**
* 获取网关信息列表
*/

View File

@ -41,7 +41,6 @@ public class AlarmDataServiceImpl implements AlarmDataService {
private EquipAlarmDataService equipAlarmDataService;
@Override
@TenantIgnore
public Long createAlarmData(AlarmDataSaveReqVO createReqVO) {
// 插入
AlarmDataDO alarmData = BeanUtils.toBean(createReqVO, AlarmDataDO.class);
@ -51,7 +50,6 @@ public class AlarmDataServiceImpl implements AlarmDataService {
}
@Override
@TenantIgnore
public void updateAlarmData(AlarmDataSaveReqVO updateReqVO) {
// 校验存在
validateAlarmDataExists(updateReqVO.getAlarmDataId());
@ -61,7 +59,6 @@ public class AlarmDataServiceImpl implements AlarmDataService {
}
@Override
@TenantIgnore
public void deleteAlarmData(Long id) {
// 校验存在
validateAlarmDataExists(id);
@ -69,25 +66,23 @@ public class AlarmDataServiceImpl implements AlarmDataService {
alarmDataMapper.deleteById(id);
}
@TenantIgnore
private void validateAlarmDataExists(Long id) {
if (alarmDataMapper.selectAlarmDataById(id) == null) {
if (alarmDataMapper.selectAlarmDataDetailsById(id) == null) {
throw exception(ALARM_DATA_NOT_EXISTS);
}
}
@Override
@TenantIgnore
public AlarmDataDTO getAlarmData(Long id) {
return alarmDataMapper.selectAlarmDataById(id);
return alarmDataMapper.selectAlarmDataDetailsById(id);
}
@Override
@TenantIgnore
public PageResult<AlarmDataDTO> getAlarmDataPage(AlarmDataPageReqVO pageReqVO) {
IPage<AlarmDataDTO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
alarmDataMapper.selectAlarmDataList(page, pageReqVO);
return new PageResult<>(page.getRecords(), page.getTotal());
// IPage<AlarmDataDTO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
// alarmDataMapper.selectAlarmDataList(page, pageReqVO);
// return new PageResult<>(page.getRecords(), page.getTotal());
return alarmDataMapper.selectAlarmDataDetailsList(pageReqVO);
}
/**
@ -95,7 +90,6 @@ public class AlarmDataServiceImpl implements AlarmDataService {
* @return 参数报警列表数据
*/
@Override
@TenantIgnore
public List<AlarmDataDO> getAlarmDataList(String equipAlarmId){
AlarmDataPageReqVO alarmData = new AlarmDataPageReqVO();
alarmData.setEquipAlarmId(equipAlarmId);
@ -106,7 +100,6 @@ public class AlarmDataServiceImpl implements AlarmDataService {
* 关闭制定设备报警id下的所有参数报警记录
*/
@Override
@TenantIgnore
@Transactional
public int closeAllAlarmDataByEquipAlarmId(String equipAlarmId){
List<AlarmDataDO> alarmDataList = alarmDataMapper.selectAlarmDatas(new AlarmDataPageReqVO().setEquipAlarmId(equipAlarmId));
@ -119,9 +112,8 @@ public class AlarmDataServiceImpl implements AlarmDataService {
}
@Override
@TenantIgnore
public AlarmDataDTO getAlarmDataByRulesId(String ruleId){
return alarmDataMapper.selectAlarmDataByRulesId(ruleId);
return alarmDataMapper.selectAlarmDataListByRulesId(ruleId);
}
@Override

View File

@ -4,6 +4,7 @@ import javax.validation.*;
import com.inspur.module.system.controller.admin.alarm.vo.*;
import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDO;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDTO;
import java.util.List;
@ -42,7 +43,7 @@ public interface AlarmRulesService {
* @param id 编号
* @return 机床报警规则
*/
AlarmRulesDO getAlarmRules(String id);
AlarmRulesDTO getAlarmRules(String id);
/**
* 获得机床报警规则分页
@ -50,10 +51,10 @@ public interface AlarmRulesService {
* @param pageReqVO 分页查询
* @return 机床报警规则分页
*/
PageResult<AlarmRulesDO> getAlarmRulesPage(AlarmRulesPageReqVO pageReqVO);
PageResult<AlarmRulesDTO> getAlarmRulesPage(AlarmRulesPageReqVO pageReqVO);
/**
* 根据设备id查询报警规则
*/
List<AlarmRulesDO> getAlarmRulesListByEquipId(String equipId);
List<AlarmRulesDTO> getAlarmRulesListByEquipId(String equipId);
}

View File

@ -3,6 +3,7 @@ package com.inspur.module.system.service.alarm;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.inspur.framework.tenant.core.aop.TenantIgnore;
import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDTO;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -36,7 +37,6 @@ public class AlarmRulesServiceImpl implements AlarmRulesService {
private StringRedisTemplate stringRedisTemplate;
@Override
@TenantIgnore
public String createAlarmRules(AlarmRulesSaveReqVO createReqVO) {
// 插入
AlarmRulesDO alarmRules = BeanUtils.toBean(createReqVO, AlarmRulesDO.class);
@ -48,7 +48,6 @@ public class AlarmRulesServiceImpl implements AlarmRulesService {
}
@Override
@TenantIgnore
public void updateAlarmRules(AlarmRulesSaveReqVO updateReqVO) {
// 校验存在
validateAlarmRulesExists(updateReqVO.getAlarmId());
@ -58,7 +57,6 @@ public class AlarmRulesServiceImpl implements AlarmRulesService {
}
@Override
@TenantIgnore
public void deleteAlarmRules(String id) {
// 校验存在
validateAlarmRulesExists(id);
@ -66,9 +64,8 @@ public class AlarmRulesServiceImpl implements AlarmRulesService {
alarmRulesMapper.deleteById(id);
}
@TenantIgnore
private void validateAlarmRulesExists(String id) {
AlarmRulesDO alarmRule = alarmRulesMapper.selectAlarmRulesById(id);
AlarmRulesDTO alarmRule = alarmRulesMapper.selectAlarmRulesDetailsById(id);
if (alarmRule == null) {
throw exception(ALARM_RULES_NOT_EXISTS);
}else{
@ -77,23 +74,21 @@ public class AlarmRulesServiceImpl implements AlarmRulesService {
}
@Override
@TenantIgnore
public AlarmRulesDO getAlarmRules(String id) {
return alarmRulesMapper.selectAlarmRulesById(id);
public AlarmRulesDTO getAlarmRules(String id) {
return alarmRulesMapper.selectAlarmRulesDetailsById(id);
}
@Override
@TenantIgnore
public PageResult<AlarmRulesDO> getAlarmRulesPage(AlarmRulesPageReqVO pageReqVO) {
IPage<AlarmRulesDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
alarmRulesMapper.selectAlarmRulesList(page, pageReqVO);
return new PageResult<>(page.getRecords(), page.getTotal());
public PageResult<AlarmRulesDTO> getAlarmRulesPage(AlarmRulesPageReqVO pageReqVO) {
// IPage<AlarmRulesDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
// alarmRulesMapper.selectAlarmRulesList(page, pageReqVO);
// return new PageResult<>(page.getRecords(), page.getTotal());
return alarmRulesMapper.selectAlarmRulesDetailsList(pageReqVO);
}
@Override
@TenantIgnore
public List<AlarmRulesDO> getAlarmRulesListByEquipId(String equipId){
return alarmRulesMapper.getAlarmRulesListByEquipId(equipId);
public List<AlarmRulesDTO> getAlarmRulesListByEquipId(String equipId){
return alarmRulesMapper.getAlarmRulesDetailsListByEquipId(equipId);
}
}

View File

@ -7,6 +7,7 @@ import com.inspur.module.system.controller.admin.alarm.vo.*;
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDO;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.common.pojo.PageParam;
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDTO;
/**
* 机床设备报警数据 Service 接口
@ -43,7 +44,7 @@ public interface EquipAlarmDataService {
* @param id 编号
* @return 机床设备报警数据
*/
EquipAlarmDataDO getEquipAlarmData(String id);
EquipAlarmDataDTO getEquipAlarmData(String id);
/**
* 获得机床设备报警数据分页
@ -51,12 +52,12 @@ public interface EquipAlarmDataService {
* @param pageReqVO 分页查询
* @return 机床设备报警数据分页
*/
PageResult<EquipAlarmDataDO> getEquipAlarmDataPage(EquipAlarmDataPageReqVO pageReqVO);
PageResult<EquipAlarmDataDTO> getEquipAlarmDataPage(EquipAlarmDataPageReqVO pageReqVO);
/**
* 通过设备id查询设备报警数据
*/
List<EquipAlarmDataDO> getEquipAlarmDataByEquipId(String equipId,Integer alarmType);
List<EquipAlarmDataDTO> getEquipAlarmDataByEquipId(String equipId,Integer alarmType);
/**
* 获取报警提交维修工单详情
@ -66,7 +67,7 @@ public interface EquipAlarmDataService {
* @param alarmId 报警id
* @return com.inspur.module.system.controller.admin.alarm.vo.AlarmSubmitOrderDetailsVO
*/
AlarmSubmitOrderDetailsVO getSubmitOrderDetails(String alarmId);
EquipAlarmDataDTO getSubmitOrderDetails(String alarmId);
/**
* 判断报警是否已经提交工单

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.inspur.framework.tenant.core.aop.TenantIgnore;
import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDO;
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDTO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO;
import com.inspur.module.system.dal.mysql.maintenance.MaintenanceOrderMapper;
import org.springframework.stereotype.Service;
@ -45,7 +46,6 @@ public class EquipAlarmDataServiceImpl implements EquipAlarmDataService {
private MaintenanceOrderMapper maintenanceOrderMapper;
@Override
@TenantIgnore
public String createEquipAlarmData(EquipAlarmDataSaveReqVO createReqVO) {
// 插入
EquipAlarmDataDO equipAlarmData = BeanUtils.toBean(createReqVO, EquipAlarmDataDO.class);
@ -55,7 +55,6 @@ public class EquipAlarmDataServiceImpl implements EquipAlarmDataService {
}
@Override
@TenantIgnore
public void updateEquipAlarmData(EquipAlarmDataSaveReqVO updateReqVO) {
// 校验存在
validateEquipAlarmDataExists(updateReqVO.getEquipAlarmId());
@ -65,7 +64,6 @@ public class EquipAlarmDataServiceImpl implements EquipAlarmDataService {
}
@Override
@TenantIgnore
public void deleteEquipAlarmData(String id) {
// 校验存在
validateEquipAlarmDataExists(id);
@ -73,41 +71,36 @@ public class EquipAlarmDataServiceImpl implements EquipAlarmDataService {
equipAlarmDataMapper.deleteById(id);
}
@TenantIgnore
private void validateEquipAlarmDataExists(String id) {
if (equipAlarmDataMapper.selectEquipAlarmById(id) == null) {
if (equipAlarmDataMapper.selectEquipAlarmDetailsById(id) == null) {
throw exception(EQUIP_ALARM_DATA_NOT_EXISTS);
}
}
@Override
@TenantIgnore
public EquipAlarmDataDO getEquipAlarmData(String id) {
return equipAlarmDataMapper.selectEquipAlarmById(id);
public EquipAlarmDataDTO getEquipAlarmData(String id) {
return equipAlarmDataMapper.selectEquipAlarmDetailsById(id);
}
@Override
@TenantIgnore
public PageResult<EquipAlarmDataDO> getEquipAlarmDataPage(EquipAlarmDataPageReqVO pageReqVO) {
IPage<EquipAlarmDataDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
equipAlarmDataMapper.selectEquipAlarmList(page, pageReqVO);
return new PageResult<>(page.getRecords(), page.getTotal());
public PageResult<EquipAlarmDataDTO> getEquipAlarmDataPage(EquipAlarmDataPageReqVO pageReqVO) {
// IPage<EquipAlarmDataDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
// equipAlarmDataMapper.selectEquipAlarmList(page, pageReqVO);
// return new PageResult<>(page.getRecords(), page.getTotal());
return equipAlarmDataMapper.selectEquipAlarmDetailsList(pageReqVO);
}
@Override
@TenantIgnore
public List<EquipAlarmDataDO> getEquipAlarmDataByEquipId(String equipId,Integer alarmType) {
return equipAlarmDataMapper.getEquipAlarmDataByEquipIdAndAlarmType(equipId,alarmType);
public List<EquipAlarmDataDTO> getEquipAlarmDataByEquipId(String equipId,Integer alarmType) {
return equipAlarmDataMapper.getEquipAlarmDataDetailsByEquipIdAndAlarmType(equipId,alarmType);
}
@Override
@TenantIgnore
public AlarmSubmitOrderDetailsVO getSubmitOrderDetails(String alarmId) {
return equipAlarmDataMapper.getSubmitOrderDetails(alarmId);
public EquipAlarmDataDTO getSubmitOrderDetails(String alarmId) {
return equipAlarmDataMapper.selectEquipAlarmDetailsById(alarmId);
}
@Override
@TenantIgnore
public String isSubmitOrder(String alarmId) {
List<MaintenanceOrderDO> list = maintenanceOrderMapper.selectList(new LambdaQueryWrapper<MaintenanceOrderDO>()
.eq(MaintenanceOrderDO::getAlarmId, alarmId)

View File

@ -6,7 +6,7 @@ import javax.validation.*;
import com.inspur.module.system.controller.admin.gatewayinfo.vo.*;
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDO;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.common.pojo.PageParam;
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDetailsDTO;
/**
* 机床网关信息 Service 接口
@ -43,7 +43,7 @@ public interface GatewayInfoService {
* @param id 编号
* @return 机床网关信息
*/
GatewayInfoDO getGatewayInfo(String id);
GatewayInfoDetailsDTO getGatewayInfo(String id);
/**
* 获得机床网关信息分页
@ -51,17 +51,17 @@ public interface GatewayInfoService {
* @param pageReqVO 分页查询
* @return 机床网关信息分页
*/
PageResult<GatewayInfoDO> getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO);
PageResult<GatewayInfoDetailsDTO> getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO);
/**
* 获取机床网关列表
*/
List<GatewayInfoDO> getGatewayInfoList();
List<GatewayInfoDetailsDTO> getGatewayInfoList();
/**
* 根据机床网关编号获取机床网关信息
*/
GatewayInfoDO getGatewayInfoByGatewayCode(String gatewayCode);
GatewayInfoDetailsDTO getGatewayInfoByGatewayCode(String gatewayCode);
/**
* 根据网关id获取机床网关网卡信息和参数信息

View File

@ -1,12 +1,10 @@
package com.inspur.module.system.service.gatewayinfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.inspur.framework.common.util.json.JsonUtils;
import com.inspur.framework.tenant.core.aop.TenantIgnore;
import com.inspur.module.system.dal.dataobject.alarm.AlarmRulesDO;
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardInfoDO;
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardParamsDO;
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDetailsDTO;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
@ -14,14 +12,12 @@ import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.inspur.module.system.controller.admin.gatewayinfo.vo.*;
import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayInfoDO;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.common.pojo.PageParam;
import com.inspur.framework.common.util.object.BeanUtils;
import com.inspur.module.system.dal.mysql.gatewayinfo.GatewayInfoMapper;
@ -52,9 +48,9 @@ public class GatewayInfoServiceImpl implements GatewayInfoService {
@PostConstruct
public void init() {
List<GatewayInfoDO> gatewayInfoList = getGatewayInfoList();
List<GatewayInfoDetailsDTO> gatewayInfoList = getGatewayInfoList();
for (GatewayInfoDO gatewayInfo : gatewayInfoList) {
for (GatewayInfoDetailsDTO gatewayInfo : gatewayInfoList) {
getGatewayCardAndParamByCatch(gatewayInfo.getGatewayId());
}
}
@ -91,31 +87,32 @@ public class GatewayInfoServiceImpl implements GatewayInfoService {
@TenantIgnore
private void validateGatewayInfoExists(String id) {
if (gatewayInfoMapper.selectGatewayById(id) == null) {
if (gatewayInfoMapper.selectGatewayDetailsById(id) == null) {
throw exception(GATEWAY_INFO_NOT_EXISTS);
}
}
@Override
@TenantIgnore
public GatewayInfoDO getGatewayInfo(String id) {
return gatewayInfoMapper.selectGatewayById(id);
public GatewayInfoDetailsDTO getGatewayInfo(String id) {
return gatewayInfoMapper.selectGatewayDetailsById(id);
}
@Override
@TenantIgnore
public PageResult<GatewayInfoDO> getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO) {
IPage<GatewayInfoDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
gatewayInfoMapper.selectGatewayList(page, pageReqVO);
return new PageResult<>(page.getRecords(), page.getTotal());
public PageResult<GatewayInfoDetailsDTO> getGatewayInfoPage(GatewayInfoPageReqVO pageReqVO) {
// IPage<GatewayInfoDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
// gatewayInfoMapper.selectGatewayList(page, pageReqVO);
// return new PageResult<>(page.getRecords(), page.getTotal());
return gatewayInfoMapper.selectGatewayDetailsList(pageReqVO);
}
/**
* 获取机床网关列表
*/
@Override
public List<GatewayInfoDO> getGatewayInfoList(){
return gatewayInfoMapper.selectAllGatewayList();
public List<GatewayInfoDetailsDTO> getGatewayInfoList(){
return gatewayInfoMapper.selectAllGatewayDetailsList();
}
/**
@ -123,8 +120,8 @@ public class GatewayInfoServiceImpl implements GatewayInfoService {
*/
@Override
@TenantIgnore
public GatewayInfoDO getGatewayInfoByGatewayCode(String gatewayCode){
return gatewayInfoMapper.selectGatewayByGatewayCode(gatewayCode);
public GatewayInfoDetailsDTO getGatewayInfoByGatewayCode(String gatewayCode){
return gatewayInfoMapper.selectGatewayDetailsByGatewayCode(gatewayCode);
}
/**

View File

@ -21,7 +21,7 @@
</resultMap>
<sql id="selectGatewayInfoVo">
select igi.gateway_id,igi.equip_id,igi.gateway_name,igi.gateway_model,igi.gateway_code,igi.gateway_mfg,igi.gateway_location,igi.firmware_version,igi.ip_address,igi.gateway_spn,igi.status,igi.gateway_pic_path,igi.remark,iei.equip_no,imi.model_name,ic.customer_name FROM `imt_gateway_info` igi
select igi.gateway_id,igi.equip_id,igi.gateway_name,igi.gateway_model,igi.gateway_code,igi.gateway_mfg,igi.gateway_location,igi.firmware_version,igi.ip_address,igi.gateway_spn,igi.status,igi.gateway_pic_path,igi.remark FROM `imt_gateway_info` igi
left join imt_equip_info iei on igi.equip_id = iei.equip_id
left join imt_model_info imi on iei.model_id = imi.model_id
left join imt_customer_info ic on iei.customer_id = ic.customer_id

View File

@ -287,6 +287,7 @@ imt:
- rep_demo_jianpiao
- tmp_report_data_1
- tmp_report_data_income
- imt_model_info
ignore-caches:
- permission_menu_ids
- oauth_client

View File

@ -42,13 +42,17 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="机床设备" prop="equipId">
<el-form-item
label="机床设备"
prop="equipId"
>
<el-cascader
v-model="cascaderValue"
:options="equipCascader"
:props="{ value: 'id',label: 'name',children: 'children'}"
clearable
@change="cascaderChange"></el-cascader>
@change="cascaderChange"
></el-cascader>
</el-form-item>
<el-form-item
label="等级"
@ -144,11 +148,11 @@
align="center"
prop="equipNo"
/>
<el-table-column
<!-- <el-table-column
label="机床组件"
align="center"
prop="componentName"
/>
/> -->
<el-table-column
label="规则上限值"
align="center"
@ -283,13 +287,17 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="机床设备" prop="equipId">
<el-form-item
label="机床设备"
prop="equipId"
>
<el-cascader
v-model="cascaderValue"
:options="equipCascader"
:props="{ value: 'id',label: 'name',children: 'children'}"
clearable
@change="cascaderChange"></el-cascader>
@change="cascaderChange"
></el-cascader>
</el-form-item>
<el-form-item
label="等级"
@ -585,7 +593,10 @@
<script>
import * as AlarmRulesApi from "@/api/system/alarm/alarmrules";
import AlarmRulesForm from "./AlarmRulesForm.vue";
import {getEquipCascader, getEquipSelection} from "@/api/system/equip/equipInfo";
import {
getEquipCascader,
getEquipSelection,
} from "@/api/system/equip/equipInfo";
export default {
name: "AlarmRules",
components: {
@ -593,7 +604,7 @@ export default {
},
data() {
return {
cascaderValue:[],
cascaderValue: [],
equipCascader: [],
//
loading: true,
@ -692,24 +703,24 @@ export default {
this.loading = true;
this.queryParams.type = this.activeName === "threshold" ? 0 : 1;
const res = await AlarmRulesApi.getAlarmRulesPage(this.queryParams);
await getEquipCascader().then(res=>{
res.forEach(item=>{
if (item.children == null){
await getEquipCascader().then((res) => {
res.forEach((item) => {
if (item.children == null) {
item.disabled = true;
}
})
});
this.equipCascader = res;
})
});
this.list = res.data.list;
this.total = res.data.total;
} finally {
this.loading = false;
}
},
cascaderChange(value){
if (value.length > 0){
cascaderChange(value) {
if (value.length > 0) {
this.queryParams.equipId = value[1];
}else {
} else {
this.queryParams.equipId = null;
}
},

View File

@ -99,6 +99,27 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item
label="租户绑定"
prop="tenantId"
>
<el-select
v-model="formData.tenantId"
placeholder="请选择租户名"
style="width:100%"
>
<el-option
v-for="item in tenantLists"
:key="parseInt(item.id)"
:label="item.label"
:value="parseInt(item.value)"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item
label="备注"
prop="remark"
@ -129,6 +150,7 @@
<script>
import * as CustomerInfoApi from "@/api/system/baseData/customerInfo";
import { getAreaTree } from "@/api/system/area";
import { getTenantList } from "@/api/system/tenant";
export default {
name: "CustomerInfoForm",
@ -167,6 +189,8 @@ export default {
{ required: true, message: "请选择所属行业", trigger: "change" },
],
},
tenantLists: [],
};
},
mounted() {
@ -174,8 +198,14 @@ export default {
const list = res.data;
this.areaTree = this.handleTreeList(list);
});
this.getTenantLists();
},
methods: {
getTenantLists() {
getTenantList().then((res) => {
this.tenantLists = res.data;
});
},
areaTreeChange(value) {
console.log(value);
},