change - add异常规则

main
zhouhy 6 months ago
parent 351696c5bc
commit 20dd2e875f

@ -0,0 +1,106 @@
package com.os.ems.record.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.os.common.annotation.Log;
import com.os.common.core.controller.BaseController;
import com.os.common.core.domain.AjaxResult;
import com.os.common.enums.BusinessType;
import com.os.ems.record.domain.EmsRecordAlarmData;
import com.os.ems.record.service.IEmsRecordAlarmDataService;
import com.os.common.utils.poi.ExcelUtil;
import com.os.common.core.page.TableDataInfo;
/**
* Controller
*
* @author Yinq
* @date 2024-05-15
*/
@RestController
@RequestMapping("/ems/record/recordAlarmData")
public class EmsRecordAlarmDataController extends BaseController
{
@Autowired
private IEmsRecordAlarmDataService emsRecordAlarmDataService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordAlarmData:list')")
@GetMapping("/list")
public TableDataInfo list(EmsRecordAlarmData emsRecordAlarmData)
{
startPage();
List<EmsRecordAlarmData> list = emsRecordAlarmDataService.selectEmsRecordAlarmDataList(emsRecordAlarmData);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordAlarmData:export')")
@Log(title = "异常数据记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EmsRecordAlarmData emsRecordAlarmData)
{
List<EmsRecordAlarmData> list = emsRecordAlarmDataService.selectEmsRecordAlarmDataList(emsRecordAlarmData);
ExcelUtil<EmsRecordAlarmData> util = new ExcelUtil<EmsRecordAlarmData>(EmsRecordAlarmData.class);
util.exportExcel(response, list, "异常数据记录数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordAlarmData:query')")
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId)
{
return success(emsRecordAlarmDataService.selectEmsRecordAlarmDataByObjId(objId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordAlarmData:add')")
@Log(title = "异常数据记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EmsRecordAlarmData emsRecordAlarmData)
{
emsRecordAlarmData.setCreateBy(getUsername());
return toAjax(emsRecordAlarmDataService.insertEmsRecordAlarmData(emsRecordAlarmData));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordAlarmData:edit')")
@Log(title = "异常数据记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EmsRecordAlarmData emsRecordAlarmData)
{
emsRecordAlarmData.setUpdateBy(getUsername());
return toAjax(emsRecordAlarmDataService.updateEmsRecordAlarmData(emsRecordAlarmData));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordAlarmData:remove')")
@Log(title = "异常数据记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds)
{
return toAjax(emsRecordAlarmDataService.deleteEmsRecordAlarmDataByObjIds(objIds));
}
}

@ -0,0 +1,106 @@
package com.os.ems.record.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.os.common.annotation.Log;
import com.os.common.core.controller.BaseController;
import com.os.common.core.domain.AjaxResult;
import com.os.common.enums.BusinessType;
import com.os.ems.record.domain.EmsRecordAlarmRule;
import com.os.ems.record.service.IEmsRecordAlarmRuleService;
import com.os.common.utils.poi.ExcelUtil;
import com.os.common.core.page.TableDataInfo;
/**
* Controller
*
* @author Yinq
* @date 2024-05-15
*/
@RestController
@RequestMapping("/ems/record/recordAlarmRule")
public class EmsRecordAlarmRuleController extends BaseController
{
@Autowired
private IEmsRecordAlarmRuleService emsRecordAlarmRuleService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordAlarmRule:list')")
@GetMapping("/list")
public TableDataInfo list(EmsRecordAlarmRule emsRecordAlarmRule)
{
startPage();
List<EmsRecordAlarmRule> list = emsRecordAlarmRuleService.selectEmsRecordAlarmRuleList(emsRecordAlarmRule);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordAlarmRule:export')")
@Log(title = "异常告警规则", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EmsRecordAlarmRule emsRecordAlarmRule)
{
List<EmsRecordAlarmRule> list = emsRecordAlarmRuleService.selectEmsRecordAlarmRuleList(emsRecordAlarmRule);
ExcelUtil<EmsRecordAlarmRule> util = new ExcelUtil<EmsRecordAlarmRule>(EmsRecordAlarmRule.class);
util.exportExcel(response, list, "异常告警规则数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordAlarmRule:query')")
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId)
{
return success(emsRecordAlarmRuleService.selectEmsRecordAlarmRuleByObjId(objId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordAlarmRule:add')")
@Log(title = "异常告警规则", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EmsRecordAlarmRule emsRecordAlarmRule)
{
emsRecordAlarmRule.setCreateBy(getUsername());
return toAjax(emsRecordAlarmRuleService.insertEmsRecordAlarmRule(emsRecordAlarmRule));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordAlarmRule:edit')")
@Log(title = "异常告警规则", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EmsRecordAlarmRule emsRecordAlarmRule)
{
emsRecordAlarmRule.setUpdateBy(getUsername());
return toAjax(emsRecordAlarmRuleService.updateEmsRecordAlarmRule(emsRecordAlarmRule));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordAlarmRule:remove')")
@Log(title = "异常告警规则", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds)
{
return toAjax(emsRecordAlarmRuleService.deleteEmsRecordAlarmRuleByObjIds(objIds));
}
}

@ -0,0 +1,232 @@
package com.os.ems.record.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.os.common.annotation.Excel;
import com.os.common.core.domain.BaseEntity;
/**
* ems_record_alarm_data
*
* @author Yinq
* @date 2024-05-15
*/
public class EmsRecordAlarmData extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 自增标识 */
private Long objId;
/** 计量设备编号 */
@Excel(name = "计量设备编号")
private String monitorId;
private String monitorCode;
private String monitorName;
/** 采集设备编号 */
@Excel(name = "采集设备编号")
private String collectDeviceId;
/** 记录时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date collectTime;
/** 异常类型0超过阈值 1设备离线 */
@Excel(name = "异常类型", readConverterExp = "0=超过阈值,1=设备离线")
private Long alarmType;
/** 异常状态0已处理 1未处理 */
@Excel(name = "异常状态", readConverterExp = "0=已处理,1=未处理")
private Long alarmStatus;
/** 异常数据 */
@Excel(name = "异常数据")
private String alarmData;
/** 操作人员 */
@Excel(name = "操作人员")
private String operationName;
/** 操作时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date operationTime;
private String beginOperationTime;
private String endOperationTime;
/** 备注 */
@Excel(name = "备注")
private String cause;
/** 通知用户 */
@Excel(name = "通知用户")
private String notifyUser;
private String nickName;
public String getBeginOperationTime() {
return beginOperationTime;
}
public void setBeginOperationTime(String beginOperationTime) {
this.beginOperationTime = beginOperationTime;
}
public String getEndOperationTime() {
return endOperationTime;
}
public void setEndOperationTime(String endOperationTime) {
this.endOperationTime = endOperationTime;
}
public String getMonitorCode() {
return monitorCode;
}
public void setMonitorCode(String monitorCode) {
this.monitorCode = monitorCode;
}
public String getMonitorName() {
return monitorName;
}
public void setMonitorName(String monitorName) {
this.monitorName = monitorName;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public void setObjId(Long objId)
{
this.objId = objId;
}
public Long getObjId()
{
return objId;
}
public void setMonitorId(String monitorId)
{
this.monitorId = monitorId;
}
public String getMonitorId()
{
return monitorId;
}
public void setCollectDeviceId(String collectDeviceId)
{
this.collectDeviceId = collectDeviceId;
}
public String getCollectDeviceId()
{
return collectDeviceId;
}
public void setCollectTime(Date collectTime)
{
this.collectTime = collectTime;
}
public Date getCollectTime()
{
return collectTime;
}
public void setAlarmType(Long alarmType)
{
this.alarmType = alarmType;
}
public Long getAlarmType()
{
return alarmType;
}
public void setAlarmStatus(Long alarmStatus)
{
this.alarmStatus = alarmStatus;
}
public Long getAlarmStatus()
{
return alarmStatus;
}
public void setAlarmData(String alarmData)
{
this.alarmData = alarmData;
}
public String getAlarmData()
{
return alarmData;
}
public void setOperationName(String operationName)
{
this.operationName = operationName;
}
public String getOperationName()
{
return operationName;
}
public void setOperationTime(Date operationTime)
{
this.operationTime = operationTime;
}
public Date getOperationTime()
{
return operationTime;
}
public void setCause(String cause)
{
this.cause = cause;
}
public String getCause()
{
return cause;
}
public void setNotifyUser(String notifyUser)
{
this.notifyUser = notifyUser;
}
public String getNotifyUser()
{
return notifyUser;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("monitorId", getMonitorId())
.append("collectDeviceId", getCollectDeviceId())
.append("collectTime", getCollectTime())
.append("alarmType", getAlarmType())
.append("alarmStatus", getAlarmStatus())
.append("alarmData", getAlarmData())
.append("operationName", getOperationName())
.append("operationTime", getOperationTime())
.append("cause", getCause())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("notifyUser", getNotifyUser())
.toString();
}
}

@ -0,0 +1,226 @@
package com.os.ems.record.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.os.common.annotation.Excel;
import com.os.common.core.domain.BaseEntity;
/**
* ems_record_alarm_rule
*
* @author Yinq
* @date 2024-05-15
*/
public class EmsRecordAlarmRule extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 自增标识 */
private Long objId;
/** 规则编号 */
@Excel(name = "规则编号")
private String ruleId;
/** 规则名称 */
@Excel(name = "规则名称")
private String ruleName;
/** 计量设备编号 */
@Excel(name = "计量设备编号")
private String monitorId;
private String monitorCode;
private String monitorName;
/** 记录时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date collectTime;
/** 能源类型 */
@Excel(name = "能源类型")
private Long energyType;
/** 触发规则0超过阈值 1设备报警 */
@Excel(name = "触发规则", readConverterExp = "0=超过阈值,1=设备报警")
private Long triggerRule;
/** 触发阈值次数 */
@Excel(name = "触发阈值次数")
private Long triggerNumber;
/** 时间范围(分) */
@Excel(name = "时间范围(分)")
private Long timeRange;
/** 设备离线时间(分) */
@Excel(name = "设备离线时间(分)")
private Long deviceOfflineTime;
/** 通知用户 */
@Excel(name = "通知用户")
private String notifyUser;
/** 备注 */
@Excel(name = "备注")
private String cause;
private String nickName;
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getMonitorCode() {
return monitorCode;
}
public void setMonitorCode(String monitorCode) {
this.monitorCode = monitorCode;
}
public String getMonitorName() {
return monitorName;
}
public void setMonitorName(String monitorName) {
this.monitorName = monitorName;
}
public void setObjId(Long objId)
{
this.objId = objId;
}
public Long getObjId()
{
return objId;
}
public void setRuleId(String ruleId)
{
this.ruleId = ruleId;
}
public String getRuleId()
{
return ruleId;
}
public void setRuleName(String ruleName)
{
this.ruleName = ruleName;
}
public String getRuleName()
{
return ruleName;
}
public void setMonitorId(String monitorId)
{
this.monitorId = monitorId;
}
public String getMonitorId()
{
return monitorId;
}
public void setCollectTime(Date collectTime)
{
this.collectTime = collectTime;
}
public Date getCollectTime()
{
return collectTime;
}
public void setEnergyType(Long energyType)
{
this.energyType = energyType;
}
public Long getEnergyType()
{
return energyType;
}
public void setTriggerRule(Long triggerRule)
{
this.triggerRule = triggerRule;
}
public Long getTriggerRule()
{
return triggerRule;
}
public void setTriggerNumber(Long triggerNumber)
{
this.triggerNumber = triggerNumber;
}
public Long getTriggerNumber()
{
return triggerNumber;
}
public void setTimeRange(Long timeRange)
{
this.timeRange = timeRange;
}
public Long getTimeRange()
{
return timeRange;
}
public void setDeviceOfflineTime(Long deviceOfflineTime)
{
this.deviceOfflineTime = deviceOfflineTime;
}
public Long getDeviceOfflineTime()
{
return deviceOfflineTime;
}
public void setNotifyUser(String notifyUser)
{
this.notifyUser = notifyUser;
}
public String getNotifyUser()
{
return notifyUser;
}
public void setCause(String cause)
{
this.cause = cause;
}
public String getCause()
{
return cause;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("ruleId", getRuleId())
.append("ruleName", getRuleName())
.append("monitorId", getMonitorId())
.append("collectTime", getCollectTime())
.append("energyType", getEnergyType())
.append("triggerRule", getTriggerRule())
.append("triggerNumber", getTriggerNumber())
.append("timeRange", getTimeRange())
.append("deviceOfflineTime", getDeviceOfflineTime())
.append("notifyUser", getNotifyUser())
.append("cause", getCause())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,61 @@
package com.os.ems.record.mapper;
import java.util.List;
import com.os.ems.record.domain.EmsRecordAlarmData;
/**
* Mapper
*
* @author Yinq
* @date 2024-05-15
*/
public interface EmsRecordAlarmDataMapper
{
/**
*
*
* @param objId
* @return
*/
public EmsRecordAlarmData selectEmsRecordAlarmDataByObjId(Long objId);
/**
*
*
* @param emsRecordAlarmData
* @return
*/
public List<EmsRecordAlarmData> selectEmsRecordAlarmDataList(EmsRecordAlarmData emsRecordAlarmData);
/**
*
*
* @param emsRecordAlarmData
* @return
*/
public int insertEmsRecordAlarmData(EmsRecordAlarmData emsRecordAlarmData);
/**
*
*
* @param emsRecordAlarmData
* @return
*/
public int updateEmsRecordAlarmData(EmsRecordAlarmData emsRecordAlarmData);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsRecordAlarmDataByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsRecordAlarmDataByObjIds(Long[] objIds);
}

@ -0,0 +1,61 @@
package com.os.ems.record.mapper;
import java.util.List;
import com.os.ems.record.domain.EmsRecordAlarmRule;
/**
* Mapper
*
* @author Yinq
* @date 2024-05-15
*/
public interface EmsRecordAlarmRuleMapper
{
/**
*
*
* @param objId
* @return
*/
public EmsRecordAlarmRule selectEmsRecordAlarmRuleByObjId(Long objId);
/**
*
*
* @param emsRecordAlarmRule
* @return
*/
public List<EmsRecordAlarmRule> selectEmsRecordAlarmRuleList(EmsRecordAlarmRule emsRecordAlarmRule);
/**
*
*
* @param emsRecordAlarmRule
* @return
*/
public int insertEmsRecordAlarmRule(EmsRecordAlarmRule emsRecordAlarmRule);
/**
*
*
* @param emsRecordAlarmRule
* @return
*/
public int updateEmsRecordAlarmRule(EmsRecordAlarmRule emsRecordAlarmRule);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsRecordAlarmRuleByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsRecordAlarmRuleByObjIds(Long[] objIds);
}

@ -0,0 +1,61 @@
package com.os.ems.record.service;
import java.util.List;
import com.os.ems.record.domain.EmsRecordAlarmData;
/**
* Service
*
* @author Yinq
* @date 2024-05-15
*/
public interface IEmsRecordAlarmDataService
{
/**
*
*
* @param objId
* @return
*/
public EmsRecordAlarmData selectEmsRecordAlarmDataByObjId(Long objId);
/**
*
*
* @param emsRecordAlarmData
* @return
*/
public List<EmsRecordAlarmData> selectEmsRecordAlarmDataList(EmsRecordAlarmData emsRecordAlarmData);
/**
*
*
* @param emsRecordAlarmData
* @return
*/
public int insertEmsRecordAlarmData(EmsRecordAlarmData emsRecordAlarmData);
/**
*
*
* @param emsRecordAlarmData
* @return
*/
public int updateEmsRecordAlarmData(EmsRecordAlarmData emsRecordAlarmData);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsRecordAlarmDataByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsRecordAlarmDataByObjId(Long objId);
}

@ -0,0 +1,61 @@
package com.os.ems.record.service;
import java.util.List;
import com.os.ems.record.domain.EmsRecordAlarmRule;
/**
* Service
*
* @author Yinq
* @date 2024-05-15
*/
public interface IEmsRecordAlarmRuleService
{
/**
*
*
* @param objId
* @return
*/
public EmsRecordAlarmRule selectEmsRecordAlarmRuleByObjId(Long objId);
/**
*
*
* @param emsRecordAlarmRule
* @return
*/
public List<EmsRecordAlarmRule> selectEmsRecordAlarmRuleList(EmsRecordAlarmRule emsRecordAlarmRule);
/**
*
*
* @param emsRecordAlarmRule
* @return
*/
public int insertEmsRecordAlarmRule(EmsRecordAlarmRule emsRecordAlarmRule);
/**
*
*
* @param emsRecordAlarmRule
* @return
*/
public int updateEmsRecordAlarmRule(EmsRecordAlarmRule emsRecordAlarmRule);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsRecordAlarmRuleByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsRecordAlarmRuleByObjId(Long objId);
}

@ -0,0 +1,96 @@
package com.os.ems.record.service.impl;
import java.util.List;
import com.os.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.os.ems.record.mapper.EmsRecordAlarmDataMapper;
import com.os.ems.record.domain.EmsRecordAlarmData;
import com.os.ems.record.service.IEmsRecordAlarmDataService;
/**
* Service
*
* @author Yinq
* @date 2024-05-15
*/
@Service
public class EmsRecordAlarmDataServiceImpl implements IEmsRecordAlarmDataService
{
@Autowired
private EmsRecordAlarmDataMapper emsRecordAlarmDataMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public EmsRecordAlarmData selectEmsRecordAlarmDataByObjId(Long objId)
{
return emsRecordAlarmDataMapper.selectEmsRecordAlarmDataByObjId(objId);
}
/**
*
*
* @param emsRecordAlarmData
* @return
*/
@Override
public List<EmsRecordAlarmData> selectEmsRecordAlarmDataList(EmsRecordAlarmData emsRecordAlarmData)
{
return emsRecordAlarmDataMapper.selectEmsRecordAlarmDataList(emsRecordAlarmData);
}
/**
*
*
* @param emsRecordAlarmData
* @return
*/
@Override
public int insertEmsRecordAlarmData(EmsRecordAlarmData emsRecordAlarmData)
{
emsRecordAlarmData.setCreateTime(DateUtils.getNowDate());
return emsRecordAlarmDataMapper.insertEmsRecordAlarmData(emsRecordAlarmData);
}
/**
*
*
* @param emsRecordAlarmData
* @return
*/
@Override
public int updateEmsRecordAlarmData(EmsRecordAlarmData emsRecordAlarmData)
{
emsRecordAlarmData.setUpdateTime(DateUtils.getNowDate());
return emsRecordAlarmDataMapper.updateEmsRecordAlarmData(emsRecordAlarmData);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteEmsRecordAlarmDataByObjIds(Long[] objIds)
{
return emsRecordAlarmDataMapper.deleteEmsRecordAlarmDataByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteEmsRecordAlarmDataByObjId(Long objId)
{
return emsRecordAlarmDataMapper.deleteEmsRecordAlarmDataByObjId(objId);
}
}

@ -0,0 +1,96 @@
package com.os.ems.record.service.impl;
import java.util.List;
import com.os.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.os.ems.record.mapper.EmsRecordAlarmRuleMapper;
import com.os.ems.record.domain.EmsRecordAlarmRule;
import com.os.ems.record.service.IEmsRecordAlarmRuleService;
/**
* Service
*
* @author Yinq
* @date 2024-05-15
*/
@Service
public class EmsRecordAlarmRuleServiceImpl implements IEmsRecordAlarmRuleService
{
@Autowired
private EmsRecordAlarmRuleMapper emsRecordAlarmRuleMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public EmsRecordAlarmRule selectEmsRecordAlarmRuleByObjId(Long objId)
{
return emsRecordAlarmRuleMapper.selectEmsRecordAlarmRuleByObjId(objId);
}
/**
*
*
* @param emsRecordAlarmRule
* @return
*/
@Override
public List<EmsRecordAlarmRule> selectEmsRecordAlarmRuleList(EmsRecordAlarmRule emsRecordAlarmRule)
{
return emsRecordAlarmRuleMapper.selectEmsRecordAlarmRuleList(emsRecordAlarmRule);
}
/**
*
*
* @param emsRecordAlarmRule
* @return
*/
@Override
public int insertEmsRecordAlarmRule(EmsRecordAlarmRule emsRecordAlarmRule)
{
emsRecordAlarmRule.setCreateTime(DateUtils.getNowDate());
return emsRecordAlarmRuleMapper.insertEmsRecordAlarmRule(emsRecordAlarmRule);
}
/**
*
*
* @param emsRecordAlarmRule
* @return
*/
@Override
public int updateEmsRecordAlarmRule(EmsRecordAlarmRule emsRecordAlarmRule)
{
emsRecordAlarmRule.setUpdateTime(DateUtils.getNowDate());
return emsRecordAlarmRuleMapper.updateEmsRecordAlarmRule(emsRecordAlarmRule);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteEmsRecordAlarmRuleByObjIds(Long[] objIds)
{
return emsRecordAlarmRuleMapper.deleteEmsRecordAlarmRuleByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteEmsRecordAlarmRuleByObjId(Long objId)
{
return emsRecordAlarmRuleMapper.deleteEmsRecordAlarmRuleByObjId(objId);
}
}

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.os.ems.record.mapper.EmsRecordAlarmDataMapper">
<resultMap type="EmsRecordAlarmData" id="EmsRecordAlarmDataResult">
<result property="objId" column="obj_id" />
<result property="monitorId" column="monitor_id" />
<result property="monitorName" column="monitor_name" />
<result property="monitorCode" column="monitor_code" />
<result property="collectDeviceId" column="collect_device_id" />
<result property="collectTime" column="collect_time" />
<result property="alarmType" column="alarm_type" />
<result property="alarmStatus" column="alarm_status" />
<result property="alarmData" column="alarm_data" />
<result property="operationName" column="operation_name" />
<result property="operationTime" column="operation_time" />
<result property="cause" column="cause" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="notifyUser" column="notify_user" />
<result property="nickName" column="nick_name" />
</resultMap>
<sql id="selectEmsRecordAlarmDataVo">
SELECT
RAD.obj_id,
RAD.monitor_id,
RAD.collect_device_id,
RAD.collect_time,
RAD.alarm_type,
RAD.alarm_status,
RAD.alarm_data,
RAD.operation_name,
RAD.operation_time,
RAD.cause,
RAD.create_by,
RAD.create_time,
RAD.update_by,
RAD.update_time,
RAD.notify_user,
BMI.monitor_code,
BMI.monitor_name,
SUSER.nick_name
FROM
ems_record_alarm_data AS RAD
LEFT JOIN ems_base_monitor_info AS BMI ON RAD.monitor_id = BMI.obj_id
LEFT JOIN sys_user AS SUSER ON RAD.notify_user = SUSER.user_id</sql>
<select id="selectEmsRecordAlarmDataList" parameterType="EmsRecordAlarmData" resultMap="EmsRecordAlarmDataResult">
<include refid="selectEmsRecordAlarmDataVo"/>
<where>
<if test="monitorId != null and monitorId != ''"> and monitor_id = #{monitorId}</if>
<if test="collectDeviceId != null and collectDeviceId != ''"> and collect_device_id = #{collectDeviceId}</if>
<if test="collectTime != null "> and collect_time = #{collectTime}</if>
<if test="alarmType != null "> and alarm_type = #{alarmType}</if>
<if test="alarmStatus != null "> and alarm_status = #{alarmStatus}</if>
<if test="alarmData != null and alarmData != ''"> and alarm_data = #{alarmData}</if>
<if test="operationName != null and operationName != ''"> and operation_name like concat('%', #{operationName}, '%')</if>
<if test="beginOperationTime != null "> and operation_time >= #{beginOperationTime}</if>
<if test="endOperationTime != null "> and #{endOperationTime} >= operation_time</if>
<if test="cause != null and cause != ''"> and cause = #{cause}</if>
<if test="notifyUser != null and notifyUser != ''"> and notify_user = #{notifyUser}</if>
</where>
</select>
<select id="selectEmsRecordAlarmDataByObjId" parameterType="Long" resultMap="EmsRecordAlarmDataResult">
<include refid="selectEmsRecordAlarmDataVo"/>
where RAD.obj_id = #{objId}
</select>
<insert id="insertEmsRecordAlarmData" parameterType="EmsRecordAlarmData" useGeneratedKeys="true" keyProperty="objId">
insert into ems_record_alarm_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="monitorId != null">monitor_id,</if>
<if test="collectDeviceId != null">collect_device_id,</if>
<if test="collectTime != null">collect_time,</if>
<if test="alarmType != null">alarm_type,</if>
<if test="alarmStatus != null">alarm_status,</if>
<if test="alarmData != null">alarm_data,</if>
<if test="operationName != null">operation_name,</if>
<if test="operationTime != null">operation_time,</if>
<if test="cause != null">cause,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="notifyUser != null">notify_user,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="monitorId != null">#{monitorId},</if>
<if test="collectDeviceId != null">#{collectDeviceId},</if>
<if test="collectTime != null">#{collectTime},</if>
<if test="alarmType != null">#{alarmType},</if>
<if test="alarmStatus != null">#{alarmStatus},</if>
<if test="alarmData != null">#{alarmData},</if>
<if test="operationName != null">#{operationName},</if>
<if test="operationTime != null">#{operationTime},</if>
<if test="cause != null">#{cause},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="notifyUser != null">#{notifyUser},</if>
</trim>
</insert>
<update id="updateEmsRecordAlarmData" parameterType="EmsRecordAlarmData">
update ems_record_alarm_data
<trim prefix="SET" suffixOverrides=",">
<if test="monitorId != null">monitor_id = #{monitorId},</if>
<if test="collectDeviceId != null">collect_device_id = #{collectDeviceId},</if>
<if test="collectTime != null">collect_time = #{collectTime},</if>
<if test="alarmType != null">alarm_type = #{alarmType},</if>
<if test="alarmStatus != null">alarm_status = #{alarmStatus},</if>
<if test="alarmData != null">alarm_data = #{alarmData},</if>
<if test="operationName != null">operation_name = #{operationName},</if>
<if test="operationTime != null">operation_time = #{operationTime},</if>
<if test="cause != null">cause = #{cause},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="notifyUser != null">notify_user = #{notifyUser},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteEmsRecordAlarmDataByObjId" parameterType="Long">
delete from ems_record_alarm_data where obj_id = #{objId}
</delete>
<delete id="deleteEmsRecordAlarmDataByObjIds" parameterType="String">
delete from ems_record_alarm_data where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.os.ems.record.mapper.EmsRecordAlarmRuleMapper">
<resultMap type="EmsRecordAlarmRule" id="EmsRecordAlarmRuleResult">
<result property="objId" column="obj_id" />
<result property="ruleId" column="rule_id" />
<result property="ruleName" column="rule_name" />
<result property="monitorId" column="monitor_id" />
<result property="monitorName" column="monitor_name" />
<result property="monitorCode" column="monitor_code" />
<result property="collectTime" column="collect_time" />
<result property="energyType" column="energy_type" />
<result property="triggerRule" column="trigger_rule" />
<result property="triggerNumber" column="trigger_number" />
<result property="timeRange" column="time_range" />
<result property="deviceOfflineTime" column="device_offline_time" />
<result property="notifyUser" column="notify_user" />
<result property="cause" column="cause" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="nickName" column="nick_name" />
</resultMap>
<sql id="selectEmsRecordAlarmRuleVo">
SELECT
RAL.obj_id,
RAL.rule_id,
RAL.rule_name,
RAL.monitor_id,
RAL.collect_time,
RAL.energy_type,
RAL.trigger_rule,
RAL.trigger_number,
RAL.time_range,
RAL.device_offline_time,
RAL.notify_user,
RAL.cause,
RAL.create_by,
RAL.create_time,
RAL.update_by,
RAL.update_time,
BMI.monitor_code,
BMI.monitor_name,
SUSER.nick_name
FROM
ems_record_alarm_rule as RAL
left join ems_base_monitor_info as BMI on RAL.monitor_id = BMI.obj_id
left join sys_user as SUSER on RAL.notify_user = SUSER.user_id
</sql>
<select id="selectEmsRecordAlarmRuleList" parameterType="EmsRecordAlarmRule" resultMap="EmsRecordAlarmRuleResult">
<include refid="selectEmsRecordAlarmRuleVo"/>
<where>
<if test="ruleId != null and ruleId != ''"> and RAL.rule_id = #{ruleId}</if>
<if test="ruleName != null and ruleName != ''"> and RAL.rule_name like concat('%', #{ruleName}, '%')</if>
<if test="monitorId != null and monitorId != ''"> and RAL.monitor_id = #{monitorId}</if>
<if test="collectTime != null "> and RAL.collect_time = #{collectTime}</if>
<if test="energyType != null "> and RAL.energy_type = #{energyType}</if>
<if test="triggerRule != null "> and RAL.trigger_rule = #{triggerRule}</if>
<if test="triggerNumber != null "> and RAL.trigger_number = #{triggerNumber}</if>
<if test="timeRange != null "> and RAL.time_range = #{timeRange}</if>
<if test="deviceOfflineTime != null "> and RAL.device_offline_time = #{deviceOfflineTime}</if>
<if test="notifyUser != null and notifyUser != ''"> and RAL.notify_user = #{notifyUser}</if>
<if test="cause != null and cause != ''"> and RAL.cause = #{cause}</if>
</where>
</select>
<select id="selectEmsRecordAlarmRuleByObjId" parameterType="Long" resultMap="EmsRecordAlarmRuleResult">
<include refid="selectEmsRecordAlarmRuleVo"/>
where RAL.obj_id = #{objId}
</select>
<insert id="insertEmsRecordAlarmRule" parameterType="EmsRecordAlarmRule" useGeneratedKeys="true" keyProperty="objId">
insert into ems_record_alarm_rule
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ruleId != null">rule_id,</if>
<if test="ruleName != null">rule_name,</if>
<if test="monitorId != null">monitor_id,</if>
<if test="collectTime != null">collect_time,</if>
<if test="energyType != null">energy_type,</if>
<if test="triggerRule != null">trigger_rule,</if>
<if test="triggerNumber != null">trigger_number,</if>
<if test="timeRange != null">time_range,</if>
<if test="deviceOfflineTime != null">device_offline_time,</if>
<if test="notifyUser != null">notify_user,</if>
<if test="cause != null">cause,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ruleId != null">#{ruleId},</if>
<if test="ruleName != null">#{ruleName},</if>
<if test="monitorId != null">#{monitorId},</if>
<if test="collectTime != null">#{collectTime},</if>
<if test="energyType != null">#{energyType},</if>
<if test="triggerRule != null">#{triggerRule},</if>
<if test="triggerNumber != null">#{triggerNumber},</if>
<if test="timeRange != null">#{timeRange},</if>
<if test="deviceOfflineTime != null">#{deviceOfflineTime},</if>
<if test="notifyUser != null">#{notifyUser},</if>
<if test="cause != null">#{cause},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateEmsRecordAlarmRule" parameterType="EmsRecordAlarmRule">
update ems_record_alarm_rule
<trim prefix="SET" suffixOverrides=",">
<if test="ruleId != null">rule_id = #{ruleId},</if>
<if test="ruleName != null">rule_name = #{ruleName},</if>
<if test="monitorId != null">monitor_id = #{monitorId},</if>
<if test="collectTime != null">collect_time = #{collectTime},</if>
<if test="energyType != null">energy_type = #{energyType},</if>
<if test="triggerRule != null">trigger_rule = #{triggerRule},</if>
<if test="triggerNumber != null">trigger_number = #{triggerNumber},</if>
<if test="timeRange != null">time_range = #{timeRange},</if>
<if test="deviceOfflineTime != null">device_offline_time = #{deviceOfflineTime},</if>
<if test="notifyUser != null">notify_user = #{notifyUser},</if>
<if test="cause != null">cause = #{cause},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteEmsRecordAlarmRuleByObjId" parameterType="Long">
delete from ems_record_alarm_rule where obj_id = #{objId}
</delete>
<delete id="deleteEmsRecordAlarmRuleByObjIds" parameterType="String">
delete from ems_record_alarm_rule where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save