13 changed files with 962 additions and 19 deletions
@ -0,0 +1,88 @@
|
||||
package com.mh.web.controller.operation; |
||||
|
||||
import com.mh.common.annotation.Log; |
||||
import com.mh.common.core.controller.BaseController; |
||||
import com.mh.common.core.domain.AjaxResult; |
||||
import com.mh.common.core.domain.entity.AlarmCode; |
||||
import com.mh.common.core.page.TableDataInfo; |
||||
import com.mh.common.enums.BusinessType; |
||||
import com.mh.system.service.operation.IAlarmCodeService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.security.access.prepost.PreAuthorize; |
||||
import org.springframework.validation.annotation.Validated; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 仪表编码页面请求 |
||||
* @date 2025-01-14 16:40:58 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/operation/ac") |
||||
public class AlarmCodeController extends BaseController { |
||||
|
||||
@Autowired |
||||
private IAlarmCodeService alarmCodeService; |
||||
|
||||
/** |
||||
* 获取报警编码记录列表内容数据 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:ac:list')") |
||||
@GetMapping("/list") |
||||
public TableDataInfo list(AlarmCode alarmCode) |
||||
{ |
||||
startPage(); |
||||
List<AlarmCode> list = alarmCodeService.selectAlarmCodeList(alarmCode); |
||||
return getDataTable(list); |
||||
} |
||||
|
||||
/** |
||||
* 根据报警编码记录id获取详细信息 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:ac:query')") |
||||
@GetMapping(value = "/{acId}") |
||||
public AjaxResult getInfo(@PathVariable String acId) |
||||
{ |
||||
return success(alarmCodeService.selectAlarmCodeById(acId)); |
||||
} |
||||
|
||||
/** |
||||
* 新增报警编码记录 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:ac:add')") |
||||
@Log(title = "报警编码记录管理", businessType = BusinessType.INSERT) |
||||
@PostMapping |
||||
public AjaxResult add(@Validated @RequestBody AlarmCode alarmCode) |
||||
{ |
||||
alarmCode.setCreateBy(getUsername()); |
||||
return toAjax(alarmCodeService.insertAlarmCode(alarmCode)); |
||||
} |
||||
|
||||
/** |
||||
* 修改报警编码记录信息 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:ac:edit')") |
||||
@Log(title = "报警编码记录管理", businessType = BusinessType.UPDATE) |
||||
@PutMapping |
||||
public AjaxResult edit(@Validated @RequestBody AlarmCode alarmCode) |
||||
{ |
||||
alarmCode.setUpdateBy(getUsername()); |
||||
return toAjax(alarmCodeService.updateAlarmCode(alarmCode)); |
||||
} |
||||
|
||||
/** |
||||
* 删除报警编码记录管理 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:ac:remove')") |
||||
@Log(title = "报警编码记录管理", businessType = BusinessType.DELETE) |
||||
@DeleteMapping("/{acIds}") |
||||
public AjaxResult remove(@PathVariable String[] acIds) |
||||
{ |
||||
return toAjax(alarmCodeService.deleteAlarmCodeByIds(acIds)); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,88 @@
|
||||
package com.mh.web.controller.operation; |
||||
|
||||
import com.mh.common.annotation.Log; |
||||
import com.mh.common.core.controller.BaseController; |
||||
import com.mh.common.core.domain.AjaxResult; |
||||
import com.mh.common.core.domain.entity.AlarmRules; |
||||
import com.mh.common.core.page.TableDataInfo; |
||||
import com.mh.common.enums.BusinessType; |
||||
import com.mh.system.service.operation.IAlarmRulesService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.security.access.prepost.PreAuthorize; |
||||
import org.springframework.validation.annotation.Validated; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 仪表报警规则 |
||||
* @date 2025-01-14 17:32:55 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/operation/ar") |
||||
public class AlarmRulesController extends BaseController { |
||||
|
||||
@Autowired |
||||
private IAlarmRulesService alarmRulesService; |
||||
|
||||
/** |
||||
* 获取报警规则记录列表内容数据 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:ar:list')") |
||||
@GetMapping("/list") |
||||
public TableDataInfo list(AlarmRules alarmRules) |
||||
{ |
||||
startPage(); |
||||
List<AlarmRules> list = alarmRulesService.selectAlarmRulesList(alarmRules); |
||||
return getDataTable(list); |
||||
} |
||||
|
||||
/** |
||||
* 根据报警规则记录id获取详细信息 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:ar:query')") |
||||
@GetMapping(value = "/{acId}") |
||||
public AjaxResult getInfo(@PathVariable String acId) |
||||
{ |
||||
return success(alarmRulesService.selectAlarmRulesById(acId)); |
||||
} |
||||
|
||||
/** |
||||
* 新增报警规则记录 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:ar:add')") |
||||
@Log(title = "报警规则记录管理", businessType = BusinessType.INSERT) |
||||
@PostMapping |
||||
public AjaxResult add(@Validated @RequestBody AlarmRules alarmRules) |
||||
{ |
||||
alarmRules.setCreateBy(getUsername()); |
||||
return toAjax(alarmRulesService.insertAlarmRules(alarmRules)); |
||||
} |
||||
|
||||
/** |
||||
* 修改报警规则记录信息 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:ar:edit')") |
||||
@Log(title = "报警规则记录管理", businessType = BusinessType.UPDATE) |
||||
@PutMapping |
||||
public AjaxResult edit(@Validated @RequestBody AlarmRules alarmRules) |
||||
{ |
||||
alarmRules.setUpdateBy(getUsername()); |
||||
return toAjax(alarmRulesService.updateAlarmRules(alarmRules)); |
||||
} |
||||
|
||||
/** |
||||
* 删除报警规则记录管理 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('system:ar:remove')") |
||||
@Log(title = "报警规则记录管理", businessType = BusinessType.DELETE) |
||||
@DeleteMapping("/{acIds}") |
||||
public AjaxResult remove(@PathVariable String[] acIds) |
||||
{ |
||||
return toAjax(alarmRulesService.deleteAlarmRulesByIds(acIds)); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,120 @@
|
||||
package com.mh.common.core.domain.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.mh.common.core.domain.BaseEntity; |
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 报警编码管理(类似模板消息) |
||||
* @date 2025-01-14 15:46:02 |
||||
*/ |
||||
@TableName("alarm_code") |
||||
public class AlarmCode extends BaseEntity { |
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||
private String id; |
||||
|
||||
/** |
||||
* 消息编码 |
||||
*/ |
||||
private String msgCode; |
||||
|
||||
/** |
||||
* 采集类别 |
||||
*/ |
||||
private String collectionType; |
||||
|
||||
/** |
||||
* 事件类型 |
||||
*/ |
||||
private String eventType; |
||||
|
||||
/** |
||||
* 报警等级 |
||||
*/ |
||||
private String alarmLevel; |
||||
|
||||
/** |
||||
* 消息标题 |
||||
*/ |
||||
private String msgTitle; |
||||
|
||||
/** |
||||
* 消息内容 |
||||
*/ |
||||
private String msgContent; |
||||
|
||||
public String getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(String id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public String getMsgCode() { |
||||
return msgCode; |
||||
} |
||||
|
||||
public void setMsgCode(String msgCode) { |
||||
this.msgCode = msgCode; |
||||
} |
||||
|
||||
public String getCollectionType() { |
||||
return collectionType; |
||||
} |
||||
|
||||
public void setCollectionType(String collectionType) { |
||||
this.collectionType = collectionType; |
||||
} |
||||
|
||||
public String getEventType() { |
||||
return eventType; |
||||
} |
||||
|
||||
public void setEventType(String eventType) { |
||||
this.eventType = eventType; |
||||
} |
||||
|
||||
public String getAlarmLevel() { |
||||
return alarmLevel; |
||||
} |
||||
|
||||
public void setAlarmLevel(String alarmLevel) { |
||||
this.alarmLevel = alarmLevel; |
||||
} |
||||
|
||||
public String getMsgTitle() { |
||||
return msgTitle; |
||||
} |
||||
|
||||
public void setMsgTitle(String msgTitle) { |
||||
this.msgTitle = msgTitle; |
||||
} |
||||
|
||||
public String getMsgContent() { |
||||
return msgContent; |
||||
} |
||||
|
||||
public void setMsgContent(String msgContent) { |
||||
this.msgContent = msgContent; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new ToStringBuilder(this) |
||||
.append("id", id) |
||||
.append("msgCode", msgCode) |
||||
.append("collectionType", collectionType) |
||||
.append("eventType", eventType) |
||||
.append("alarmLevel", alarmLevel) |
||||
.append("msgTitle", msgTitle) |
||||
.append("msgContent", msgContent) |
||||
.toString(); |
||||
} |
||||
} |
@ -0,0 +1,304 @@
|
||||
package com.mh.common.core.domain.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.mh.common.core.domain.BaseEntity; |
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 仪表报警规则 |
||||
* @date 2025-01-14 15:46:02 |
||||
*/ |
||||
@TableName("alarm_rules") |
||||
public class AlarmRules extends BaseEntity { |
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||
private String id; |
||||
|
||||
/** |
||||
* 事件类型 |
||||
*/ |
||||
private String eventType; |
||||
|
||||
/** |
||||
* 报警等级 |
||||
*/ |
||||
private String alarmLevel; |
||||
|
||||
/** |
||||
* 报警类型 |
||||
*/ |
||||
private String alarmType; |
||||
|
||||
/** |
||||
* 设备台账id |
||||
*/ |
||||
private String ledgerId; |
||||
|
||||
/** |
||||
* 设备名称 |
||||
*/ |
||||
private String deviceName; |
||||
|
||||
/** |
||||
* 采集仪表参数id |
||||
*/ |
||||
private String cpmId; |
||||
|
||||
/** |
||||
* 采集仪表参数名称 |
||||
*/ |
||||
private String cpmName; |
||||
|
||||
/** |
||||
* 参数编号(仪表编号) |
||||
*/ |
||||
private String cpmMtNum; |
||||
|
||||
/** |
||||
* 报警延时时间 |
||||
*/ |
||||
private Integer delayTimes; |
||||
|
||||
/** |
||||
* 报警时段设置标志(0:全时段,1:自定义时段) |
||||
*/ |
||||
private Integer timePeriodSet; |
||||
|
||||
/** |
||||
* 自定义时段开始时间 |
||||
*/ |
||||
private Date beginTime; |
||||
|
||||
/** |
||||
* 自定义时段结束时间 |
||||
*/ |
||||
private Date endTime; |
||||
|
||||
/** |
||||
* 选择遥信事件显示:触发事件(0:开,1:关) |
||||
*/ |
||||
private Integer triggerEvent; |
||||
|
||||
/** |
||||
* 条件1 |
||||
*/ |
||||
private String condition1; |
||||
|
||||
/** |
||||
* 阈值1 |
||||
*/ |
||||
private String threshold1; |
||||
|
||||
/** |
||||
* 条件2 |
||||
*/ |
||||
private String condition2; |
||||
|
||||
/** |
||||
* 阈值2 |
||||
*/ |
||||
private String threshold2; |
||||
|
||||
/** |
||||
* 能源节点 |
||||
*/ |
||||
private String energyNode; |
||||
|
||||
/** |
||||
* 能源类型 |
||||
*/ |
||||
private String energyType; |
||||
|
||||
public String getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(String id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public String getEventType() { |
||||
return eventType; |
||||
} |
||||
|
||||
public void setEventType(String eventType) { |
||||
this.eventType = eventType; |
||||
} |
||||
|
||||
public String getAlarmLevel() { |
||||
return alarmLevel; |
||||
} |
||||
|
||||
public void setAlarmLevel(String alarmLevel) { |
||||
this.alarmLevel = alarmLevel; |
||||
} |
||||
|
||||
public String getAlarmType() { |
||||
return alarmType; |
||||
} |
||||
|
||||
public void setAlarmType(String alarmType) { |
||||
this.alarmType = alarmType; |
||||
} |
||||
|
||||
public String getLedgerId() { |
||||
return ledgerId; |
||||
} |
||||
|
||||
public void setLedgerId(String ledgerId) { |
||||
this.ledgerId = ledgerId; |
||||
} |
||||
|
||||
public String getDeviceName() { |
||||
return deviceName; |
||||
} |
||||
|
||||
public void setDeviceName(String deviceName) { |
||||
this.deviceName = deviceName; |
||||
} |
||||
|
||||
public String getCpmId() { |
||||
return cpmId; |
||||
} |
||||
|
||||
public void setCpmId(String cpmId) { |
||||
this.cpmId = cpmId; |
||||
} |
||||
|
||||
public String getCpmName() { |
||||
return cpmName; |
||||
} |
||||
|
||||
public void setCpmName(String cpmName) { |
||||
this.cpmName = cpmName; |
||||
} |
||||
|
||||
public String getCpmMtNum() { |
||||
return cpmMtNum; |
||||
} |
||||
|
||||
public void setCpmMtNum(String cpmMtNum) { |
||||
this.cpmMtNum = cpmMtNum; |
||||
} |
||||
|
||||
public Integer getDelayTimes() { |
||||
return delayTimes; |
||||
} |
||||
|
||||
public void setDelayTimes(Integer delayTimes) { |
||||
this.delayTimes = delayTimes; |
||||
} |
||||
|
||||
public Integer getTimePeriodSet() { |
||||
return timePeriodSet; |
||||
} |
||||
|
||||
public void setTimePeriodSet(Integer timePeriodSet) { |
||||
this.timePeriodSet = timePeriodSet; |
||||
} |
||||
|
||||
public Date getBeginTime() { |
||||
return beginTime; |
||||
} |
||||
|
||||
public void setBeginTime(Date beginTime) { |
||||
this.beginTime = beginTime; |
||||
} |
||||
|
||||
public Date getEndTime() { |
||||
return endTime; |
||||
} |
||||
|
||||
public void setEndTime(Date endTime) { |
||||
this.endTime = endTime; |
||||
} |
||||
|
||||
public Integer getTriggerEvent() { |
||||
return triggerEvent; |
||||
} |
||||
|
||||
public void setTriggerEvent(Integer triggerEvent) { |
||||
this.triggerEvent = triggerEvent; |
||||
} |
||||
|
||||
public String getCondition1() { |
||||
return condition1; |
||||
} |
||||
|
||||
public void setCondition1(String condition1) { |
||||
this.condition1 = condition1; |
||||
} |
||||
|
||||
public String getThreshold1() { |
||||
return threshold1; |
||||
} |
||||
|
||||
public void setThreshold1(String threshold1) { |
||||
this.threshold1 = threshold1; |
||||
} |
||||
|
||||
public String getCondition2() { |
||||
return condition2; |
||||
} |
||||
|
||||
public void setCondition2(String condition2) { |
||||
this.condition2 = condition2; |
||||
} |
||||
|
||||
public String getThreshold2() { |
||||
return threshold2; |
||||
} |
||||
|
||||
public void setThreshold2(String threshold2) { |
||||
this.threshold2 = threshold2; |
||||
} |
||||
|
||||
public String getEnergyNode() { |
||||
return energyNode; |
||||
} |
||||
|
||||
public void setEnergyNode(String energyNode) { |
||||
this.energyNode = energyNode; |
||||
} |
||||
|
||||
public String getEnergyType() { |
||||
return energyType; |
||||
} |
||||
|
||||
public void setEnergyType(String energyType) { |
||||
this.energyType = energyType; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new ToStringBuilder(this) |
||||
.append("id", id) |
||||
.append("eventType", eventType) |
||||
.append("alarmLevel", alarmLevel) |
||||
.append("alarmType", alarmType) |
||||
.append("ledgerId", ledgerId) |
||||
.append("deviceName", deviceName) |
||||
.append("cpmId", cpmId) |
||||
.append("cpmName", cpmName) |
||||
.append("cpmMtNum", cpmMtNum) |
||||
.append("delayTimes", delayTimes) |
||||
.append("timePeriodSet", timePeriodSet) |
||||
.append("beginTime", beginTime) |
||||
.append("endTime", endTime) |
||||
.append("triggerEvent", triggerEvent) |
||||
.append("condition1", condition1) |
||||
.append("threshold1", threshold1) |
||||
.append("condition2", condition2) |
||||
.append("threshold2", threshold2) |
||||
.append("energyNode", energyNode) |
||||
.append("energyType", energyType) |
||||
.toString(); |
||||
} |
||||
} |
@ -0,0 +1,16 @@
|
||||
package com.mh.system.mapper.operation; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.mh.common.core.domain.entity.AlarmCode; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 报警编码mapper |
||||
* @date 2025-01-14 17:23:32 |
||||
*/ |
||||
@Mapper |
||||
public interface AlarmCodeMapper extends BaseMapper<AlarmCode> { |
||||
} |
@ -0,0 +1,16 @@
|
||||
package com.mh.system.mapper.operation; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.mh.common.core.domain.entity.AlarmRules; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 报警编码mapper |
||||
* @date 2025-01-14 17:23:32 |
||||
*/ |
||||
@Mapper |
||||
public interface AlarmRulesMapper extends BaseMapper<AlarmRules> { |
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.mh.system.service.operation; |
||||
|
||||
import com.mh.common.core.domain.entity.AlarmCode; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 报警编码页面请求 |
||||
* @date 2025-01-14 16:52:23 |
||||
*/ |
||||
public interface IAlarmCodeService { |
||||
List<AlarmCode> selectAlarmCodeList(AlarmCode alarmCode); |
||||
|
||||
AlarmCode selectAlarmCodeById(String acId); |
||||
|
||||
int insertAlarmCode(AlarmCode alarmCode); |
||||
|
||||
int updateAlarmCode(AlarmCode alarmCode); |
||||
|
||||
int deleteAlarmCodeByIds(String[] acIds); |
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.mh.system.service.operation; |
||||
|
||||
import com.mh.common.core.domain.entity.AlarmRules; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 报警规则处理接口 |
||||
* @date 2025-01-14 16:52:23 |
||||
*/ |
||||
public interface IAlarmRulesService { |
||||
List<AlarmRules> selectAlarmRulesList(AlarmRules alarmCode); |
||||
|
||||
AlarmRules selectAlarmRulesById(String acId); |
||||
|
||||
int insertAlarmRules(AlarmRules alarmCode); |
||||
|
||||
int updateAlarmRules(AlarmRules alarmCode); |
||||
|
||||
int deleteAlarmRulesByIds(String[] acIds); |
||||
} |
@ -0,0 +1,86 @@
|
||||
package com.mh.system.service.operation.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.mh.common.core.domain.entity.AlarmCode; |
||||
import com.mh.common.utils.StringUtils; |
||||
import com.mh.system.mapper.operation.AlarmCodeMapper; |
||||
import com.mh.system.service.operation.IAlarmCodeService; |
||||
import jakarta.annotation.Resource; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 报警编码页面请求实现类 |
||||
* @date 2025-01-14 16:53:08 |
||||
*/ |
||||
@Service |
||||
public class AlarmCodeServiceImpl implements IAlarmCodeService { |
||||
|
||||
@Resource |
||||
private AlarmCodeMapper alarmCodeMapper; |
||||
|
||||
@Override |
||||
public List<AlarmCode> selectAlarmCodeList(AlarmCode alarmCode) { |
||||
if (alarmCode == null) { |
||||
return List.of(); |
||||
} |
||||
QueryWrapper<AlarmCode> queryWrapper = new QueryWrapper<>(); |
||||
// 消息编码
|
||||
if (!StringUtils.isEmpty(alarmCode.getMsgCode())) { |
||||
queryWrapper.like("msg_code", alarmCode.getMsgCode()); |
||||
} |
||||
// 采集类别
|
||||
if (!StringUtils.isEmpty(alarmCode.getCollectionType())) { |
||||
queryWrapper.eq("collection_type", alarmCode.getCollectionType()); |
||||
} |
||||
// 事件类型
|
||||
if (!StringUtils.isEmpty(alarmCode.getEventType())) { |
||||
queryWrapper.eq("event_type", alarmCode.getEventType()); |
||||
} |
||||
// 报警等级
|
||||
if (!StringUtils.isEmpty(alarmCode.getAlarmLevel())) { |
||||
queryWrapper.eq("alarm_level", alarmCode.getAlarmLevel()); |
||||
} |
||||
queryWrapper.orderByDesc("create_time"); |
||||
return alarmCodeMapper.selectList(queryWrapper); |
||||
} |
||||
|
||||
@Override |
||||
public AlarmCode selectAlarmCodeById(String acId) { |
||||
if (StringUtils.isEmpty(acId)) { |
||||
return null; |
||||
} |
||||
return alarmCodeMapper.selectById(acId); |
||||
} |
||||
|
||||
@Override |
||||
public int insertAlarmCode(AlarmCode alarmCode) { |
||||
if (alarmCode != null) { |
||||
return alarmCodeMapper.insert(alarmCode); |
||||
} |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public int updateAlarmCode(AlarmCode alarmCode) { |
||||
if (alarmCode != null) { |
||||
return alarmCodeMapper.updateById(alarmCode); |
||||
} |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public int deleteAlarmCodeByIds(String[] acIds) { |
||||
if (acIds != null && acIds.length > 0) { |
||||
for (String acId : acIds) { |
||||
alarmCodeMapper.deleteById(acId); |
||||
} |
||||
return acIds.length; |
||||
} |
||||
return 0; |
||||
} |
||||
} |
@ -0,0 +1,82 @@
|
||||
package com.mh.system.service.operation.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.mh.common.core.domain.entity.AlarmRules; |
||||
import com.mh.common.utils.StringUtils; |
||||
import com.mh.system.mapper.operation.AlarmRulesMapper; |
||||
import com.mh.system.service.operation.IAlarmRulesService; |
||||
import jakarta.annotation.Resource; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 报警编码页面请求实现类 |
||||
* @date 2025-01-14 16:53:08 |
||||
*/ |
||||
@Service |
||||
public class AlarmRulesServiceImpl implements IAlarmRulesService { |
||||
|
||||
@Resource |
||||
private AlarmRulesMapper alarmRulesMapper; |
||||
|
||||
@Override |
||||
public List<AlarmRules> selectAlarmRulesList(AlarmRules alarmRules) { |
||||
if (alarmRules == null) { |
||||
return List.of(); |
||||
} |
||||
QueryWrapper<AlarmRules> queryWrapper = new QueryWrapper<>(); |
||||
// 报警类型
|
||||
if (!StringUtils.isEmpty(alarmRules.getAlarmType())) { |
||||
queryWrapper.eq("alarm_type", alarmRules.getAlarmType()); |
||||
} |
||||
// 事件类型
|
||||
if (!StringUtils.isEmpty(alarmRules.getEventType())) { |
||||
queryWrapper.eq("event_type", alarmRules.getEventType()); |
||||
} |
||||
// 报警等级
|
||||
if (!StringUtils.isEmpty(alarmRules.getAlarmLevel())) { |
||||
queryWrapper.eq("alarm_level", alarmRules.getAlarmLevel()); |
||||
} |
||||
queryWrapper.orderByDesc("create_time"); |
||||
return alarmRulesMapper.selectList(queryWrapper); |
||||
} |
||||
|
||||
@Override |
||||
public AlarmRules selectAlarmRulesById(String acId) { |
||||
if (StringUtils.isEmpty(acId)) { |
||||
return null; |
||||
} |
||||
return alarmRulesMapper.selectById(acId); |
||||
} |
||||
|
||||
@Override |
||||
public int insertAlarmRules(AlarmRules alarmRules) { |
||||
if (alarmRules != null) { |
||||
return alarmRulesMapper.insert(alarmRules); |
||||
} |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public int updateAlarmRules(AlarmRules alarmRules) { |
||||
if (alarmRules != null) { |
||||
return alarmRulesMapper.updateById(alarmRules); |
||||
} |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public int deleteAlarmRulesByIds(String[] acIds) { |
||||
if (acIds != null && acIds.length > 0) { |
||||
for (String acId : acIds) { |
||||
alarmRulesMapper.deleteById(acId); |
||||
} |
||||
return acIds.length; |
||||
} |
||||
return 0; |
||||
} |
||||
} |
Loading…
Reference in new issue