change - add异常规则
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,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…
Reference in New Issue