add - 异常数据查询
parent
4d9606e331
commit
95aa19d43f
@ -0,0 +1,126 @@
|
||||
package com.ruoyi.web.controller.record;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.RecordAlarm;
|
||||
import com.ruoyi.system.service.IRecordAlarmService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 异常数据记录Controller
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022-03-26
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/record/recordAlarm")
|
||||
public class RecordAlarmController extends BaseController
|
||||
{
|
||||
private String prefix = "record/recordAlarm";
|
||||
|
||||
@Autowired
|
||||
private IRecordAlarmService recordAlarmService;
|
||||
|
||||
@RequiresPermissions("record:recordAlarm:view")
|
||||
@GetMapping()
|
||||
public String recordAlarm()
|
||||
{
|
||||
return prefix + "/recordAlarm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询异常数据记录列表
|
||||
*/
|
||||
@RequiresPermissions("record:recordAlarm:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(RecordAlarm recordAlarm)
|
||||
{
|
||||
startPage();
|
||||
List<RecordAlarm> list = recordAlarmService.selectRecordAlarmList(recordAlarm);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出异常数据记录列表
|
||||
*/
|
||||
@RequiresPermissions("record:recordAlarm:export")
|
||||
@Log(title = "异常数据记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(RecordAlarm recordAlarm)
|
||||
{
|
||||
List<RecordAlarm> list = recordAlarmService.selectRecordAlarmList(recordAlarm);
|
||||
ExcelUtil<RecordAlarm> util = new ExcelUtil<RecordAlarm>(RecordAlarm.class);
|
||||
return util.exportExcel(list, "异常数据记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增异常数据记录
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存异常数据记录
|
||||
*/
|
||||
@RequiresPermissions("record:recordAlarm:add")
|
||||
@Log(title = "异常数据记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(RecordAlarm recordAlarm)
|
||||
{
|
||||
return toAjax(recordAlarmService.insertRecordAlarm(recordAlarm));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改异常数据记录
|
||||
*/
|
||||
@GetMapping("/edit/{sensorId}")
|
||||
public String edit(@PathVariable("sensorId") String sensorId, ModelMap mmap)
|
||||
{
|
||||
RecordAlarm recordAlarm = recordAlarmService.selectRecordAlarmBySensorId(sensorId);
|
||||
mmap.put("recordAlarm", recordAlarm);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存异常数据记录
|
||||
*/
|
||||
@RequiresPermissions("record:recordAlarm:edit")
|
||||
@Log(title = "异常数据记录", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(RecordAlarm recordAlarm)
|
||||
{
|
||||
return toAjax(recordAlarmService.updateRecordAlarm(recordAlarm));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除异常数据记录
|
||||
*/
|
||||
@RequiresPermissions("record:recordAlarm:remove")
|
||||
@Log(title = "异常数据记录", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(recordAlarmService.deleteRecordAlarmBySensorIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('新增异常数据记录')" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-recordAlarm-add">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">传感器:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="sensorId" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">报警类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="alarmtypeId" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">最小值:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="minValue" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">异常值:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="alarmValue" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">最大值:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="maxValue" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">采集时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="collectTime" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "record/recordAlarm"
|
||||
$("#form-recordAlarm-add").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-recordAlarm-add').serialize());
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,62 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('修改异常数据记录')" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-recordAlarm-edit" th:object="${recordAlarm}">
|
||||
<input name="sensorId" th:field="*{sensorId}" type="hidden">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">传感器:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="sensorId" th:field="*{sensorId}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">报警类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="alarmtypeId" th:field="*{alarmtypeId}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">最小值:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="minValue" th:field="*{minValue}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">异常值:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="alarmValue" th:field="*{alarmValue}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">最大值:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="maxValue" th:field="*{maxValue}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">采集时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="collectTime" th:field="*{collectTime}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "record/recordAlarm";
|
||||
$("#form-recordAlarm-edit").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-recordAlarm-edit').serialize());
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,121 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<head>
|
||||
<th:block th:include="include :: header('异常数据记录列表')" />
|
||||
</head>
|
||||
<body class="gray-bg">
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="formId">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
<label>传感器:</label>
|
||||
<input type="text" name="sensorId"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>报警类型:</label>
|
||||
<input type="text" name="alarmtypeId"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>最小值:</label>
|
||||
<input type="text" name="minValue"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>异常值:</label>
|
||||
<input type="text" name="alarmValue"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>最大值:</label>
|
||||
<input type="text" name="maxValue"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>采集时间:</label>
|
||||
<input type="text" name="collectTime"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="record:recordAlarm:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="record:recordAlarm:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="record:recordAlarm:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="record:recordAlarm:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('record:recordAlarm:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('record:recordAlarm:remove')}]];
|
||||
var prefix = ctx + "record/recordAlarm";
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "异常数据记录",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'sensorId',
|
||||
title: '传感器'
|
||||
},
|
||||
{
|
||||
field: 'alarmtypeId',
|
||||
title: '报警类型'
|
||||
},
|
||||
{
|
||||
field: 'minValue',
|
||||
title: '最小值'
|
||||
},
|
||||
{
|
||||
field: 'alarmValue',
|
||||
title: '异常值'
|
||||
},
|
||||
{
|
||||
field: 'maxValue',
|
||||
title: '最大值'
|
||||
},
|
||||
{
|
||||
field: 'collectTime',
|
||||
title: '采集时间'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.sensorId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.sensorId + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,109 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 异常数据记录对象 record_alarm
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022-03-26
|
||||
*/
|
||||
public class RecordAlarm extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 传感器 */
|
||||
@Excel(name = "传感器")
|
||||
private String sensorId;
|
||||
|
||||
/** 报警类型 */
|
||||
@Excel(name = "报警类型")
|
||||
private String alarmtypeId;
|
||||
|
||||
/** 最小值 */
|
||||
@Excel(name = "最小值")
|
||||
private BigDecimal minValue;
|
||||
|
||||
/** 异常值 */
|
||||
@Excel(name = "异常值")
|
||||
private BigDecimal alarmValue;
|
||||
|
||||
/** 最大值 */
|
||||
@Excel(name = "最大值")
|
||||
private BigDecimal maxValue;
|
||||
|
||||
/** 采集时间 */
|
||||
@Excel(name = "采集时间")
|
||||
private String collectTime;
|
||||
|
||||
public void setSensorId(String sensorId)
|
||||
{
|
||||
this.sensorId = sensorId;
|
||||
}
|
||||
|
||||
public String getSensorId()
|
||||
{
|
||||
return sensorId;
|
||||
}
|
||||
public void setAlarmtypeId(String alarmtypeId)
|
||||
{
|
||||
this.alarmtypeId = alarmtypeId;
|
||||
}
|
||||
|
||||
public String getAlarmtypeId()
|
||||
{
|
||||
return alarmtypeId;
|
||||
}
|
||||
public void setMinValue(BigDecimal minValue)
|
||||
{
|
||||
this.minValue = minValue;
|
||||
}
|
||||
|
||||
public BigDecimal getMinValue()
|
||||
{
|
||||
return minValue;
|
||||
}
|
||||
public void setAlarmValue(BigDecimal alarmValue)
|
||||
{
|
||||
this.alarmValue = alarmValue;
|
||||
}
|
||||
|
||||
public BigDecimal getAlarmValue()
|
||||
{
|
||||
return alarmValue;
|
||||
}
|
||||
public void setMaxValue(BigDecimal maxValue)
|
||||
{
|
||||
this.maxValue = maxValue;
|
||||
}
|
||||
|
||||
public BigDecimal getMaxValue()
|
||||
{
|
||||
return maxValue;
|
||||
}
|
||||
public void setCollectTime(String collectTime)
|
||||
{
|
||||
this.collectTime = collectTime;
|
||||
}
|
||||
|
||||
public String getCollectTime()
|
||||
{
|
||||
return collectTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("sensorId", getSensorId())
|
||||
.append("alarmtypeId", getAlarmtypeId())
|
||||
.append("minValue", getMinValue())
|
||||
.append("alarmValue", getAlarmValue())
|
||||
.append("maxValue", getMaxValue())
|
||||
.append("collectTime", getCollectTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RecordAlarm;
|
||||
|
||||
/**
|
||||
* 异常数据记录Mapper接口
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022-03-26
|
||||
*/
|
||||
public interface RecordAlarmMapper
|
||||
{
|
||||
/**
|
||||
* 查询异常数据记录
|
||||
*
|
||||
* @param sensorId 异常数据记录主键
|
||||
* @return 异常数据记录
|
||||
*/
|
||||
public RecordAlarm selectRecordAlarmBySensorId(String sensorId);
|
||||
|
||||
/**
|
||||
* 查询异常数据记录列表
|
||||
*
|
||||
* @param recordAlarm 异常数据记录
|
||||
* @return 异常数据记录集合
|
||||
*/
|
||||
public List<RecordAlarm> selectRecordAlarmList(RecordAlarm recordAlarm);
|
||||
|
||||
/**
|
||||
* 新增异常数据记录
|
||||
*
|
||||
* @param recordAlarm 异常数据记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRecordAlarm(RecordAlarm recordAlarm);
|
||||
|
||||
/**
|
||||
* 修改异常数据记录
|
||||
*
|
||||
* @param recordAlarm 异常数据记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRecordAlarm(RecordAlarm recordAlarm);
|
||||
|
||||
/**
|
||||
* 删除异常数据记录
|
||||
*
|
||||
* @param sensorId 异常数据记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRecordAlarmBySensorId(String sensorId);
|
||||
|
||||
/**
|
||||
* 批量删除异常数据记录
|
||||
*
|
||||
* @param sensorIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRecordAlarmBySensorIds(String[] sensorIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RecordAlarm;
|
||||
|
||||
/**
|
||||
* 异常数据记录Service接口
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022-03-26
|
||||
*/
|
||||
public interface IRecordAlarmService
|
||||
{
|
||||
/**
|
||||
* 查询异常数据记录
|
||||
*
|
||||
* @param sensorId 异常数据记录主键
|
||||
* @return 异常数据记录
|
||||
*/
|
||||
public RecordAlarm selectRecordAlarmBySensorId(String sensorId);
|
||||
|
||||
/**
|
||||
* 查询异常数据记录列表
|
||||
*
|
||||
* @param recordAlarm 异常数据记录
|
||||
* @return 异常数据记录集合
|
||||
*/
|
||||
public List<RecordAlarm> selectRecordAlarmList(RecordAlarm recordAlarm);
|
||||
|
||||
/**
|
||||
* 新增异常数据记录
|
||||
*
|
||||
* @param recordAlarm 异常数据记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRecordAlarm(RecordAlarm recordAlarm);
|
||||
|
||||
/**
|
||||
* 修改异常数据记录
|
||||
*
|
||||
* @param recordAlarm 异常数据记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRecordAlarm(RecordAlarm recordAlarm);
|
||||
|
||||
/**
|
||||
* 批量删除异常数据记录
|
||||
*
|
||||
* @param sensorIds 需要删除的异常数据记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRecordAlarmBySensorIds(String sensorIds);
|
||||
|
||||
/**
|
||||
* 删除异常数据记录信息
|
||||
*
|
||||
* @param sensorId 异常数据记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRecordAlarmBySensorId(String sensorId);
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.RecordAlarmMapper;
|
||||
import com.ruoyi.system.domain.RecordAlarm;
|
||||
import com.ruoyi.system.service.IRecordAlarmService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 异常数据记录Service业务层处理
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022-03-26
|
||||
*/
|
||||
@Service
|
||||
public class RecordAlarmServiceImpl implements IRecordAlarmService
|
||||
{
|
||||
@Autowired
|
||||
private RecordAlarmMapper recordAlarmMapper;
|
||||
|
||||
/**
|
||||
* 查询异常数据记录
|
||||
*
|
||||
* @param sensorId 异常数据记录主键
|
||||
* @return 异常数据记录
|
||||
*/
|
||||
@Override
|
||||
public RecordAlarm selectRecordAlarmBySensorId(String sensorId)
|
||||
{
|
||||
return recordAlarmMapper.selectRecordAlarmBySensorId(sensorId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询异常数据记录列表
|
||||
*
|
||||
* @param recordAlarm 异常数据记录
|
||||
* @return 异常数据记录
|
||||
*/
|
||||
@Override
|
||||
public List<RecordAlarm> selectRecordAlarmList(RecordAlarm recordAlarm)
|
||||
{
|
||||
return recordAlarmMapper.selectRecordAlarmList(recordAlarm);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增异常数据记录
|
||||
*
|
||||
* @param recordAlarm 异常数据记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRecordAlarm(RecordAlarm recordAlarm)
|
||||
{
|
||||
return recordAlarmMapper.insertRecordAlarm(recordAlarm);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改异常数据记录
|
||||
*
|
||||
* @param recordAlarm 异常数据记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRecordAlarm(RecordAlarm recordAlarm)
|
||||
{
|
||||
return recordAlarmMapper.updateRecordAlarm(recordAlarm);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除异常数据记录
|
||||
*
|
||||
* @param sensorIds 需要删除的异常数据记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRecordAlarmBySensorIds(String sensorIds)
|
||||
{
|
||||
return recordAlarmMapper.deleteRecordAlarmBySensorIds(Convert.toStrArray(sensorIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除异常数据记录信息
|
||||
*
|
||||
* @param sensorId 异常数据记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRecordAlarmBySensorId(String sensorId)
|
||||
{
|
||||
return recordAlarmMapper.deleteRecordAlarmBySensorId(sensorId);
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
<?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.ruoyi.system.mapper.RecordAlarmMapper">
|
||||
|
||||
<resultMap type="RecordAlarm" id="RecordAlarmResult">
|
||||
<result property="sensorId" column="Sensor_Id" />
|
||||
<result property="alarmtypeId" column="AlarmType_Id" />
|
||||
<result property="minValue" column="Min_Value" />
|
||||
<result property="alarmValue" column="Alarm_Value" />
|
||||
<result property="maxValue" column="Max_Value" />
|
||||
<result property="collectTime" column="Collect_Time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRecordAlarmVo">
|
||||
select Sensor_Id, AlarmType_Id, Min_Value, Alarm_Value, Max_Value, Collect_Time from record_alarm
|
||||
</sql>
|
||||
|
||||
<select id="selectRecordAlarmList" parameterType="RecordAlarm" resultMap="RecordAlarmResult">
|
||||
<include refid="selectRecordAlarmVo"/>
|
||||
<where>
|
||||
<if test="sensorId != null and sensorId != ''"> and Sensor_Id = #{sensorId}</if>
|
||||
<if test="alarmtypeId != null and alarmtypeId != ''"> and AlarmType_Id = #{alarmtypeId}</if>
|
||||
<if test="minValue != null "> and Min_Value = #{minValue}</if>
|
||||
<if test="alarmValue != null "> and Alarm_Value = #{alarmValue}</if>
|
||||
<if test="maxValue != null "> and Max_Value = #{maxValue}</if>
|
||||
<if test="collectTime != null and collectTime != ''"> and Collect_Time = #{collectTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRecordAlarmBySensorId" parameterType="String" resultMap="RecordAlarmResult">
|
||||
<include refid="selectRecordAlarmVo"/>
|
||||
where Sensor_Id = #{sensorId}
|
||||
</select>
|
||||
|
||||
<insert id="insertRecordAlarm" parameterType="RecordAlarm">
|
||||
insert into record_alarm
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sensorId != null">Sensor_Id,</if>
|
||||
<if test="alarmtypeId != null">AlarmType_Id,</if>
|
||||
<if test="minValue != null">Min_Value,</if>
|
||||
<if test="alarmValue != null">Alarm_Value,</if>
|
||||
<if test="maxValue != null">Max_Value,</if>
|
||||
<if test="collectTime != null">Collect_Time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sensorId != null">#{sensorId},</if>
|
||||
<if test="alarmtypeId != null">#{alarmtypeId},</if>
|
||||
<if test="minValue != null">#{minValue},</if>
|
||||
<if test="alarmValue != null">#{alarmValue},</if>
|
||||
<if test="maxValue != null">#{maxValue},</if>
|
||||
<if test="collectTime != null">#{collectTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRecordAlarm" parameterType="RecordAlarm">
|
||||
update record_alarm
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="alarmtypeId != null">AlarmType_Id = #{alarmtypeId},</if>
|
||||
<if test="minValue != null">Min_Value = #{minValue},</if>
|
||||
<if test="alarmValue != null">Alarm_Value = #{alarmValue},</if>
|
||||
<if test="maxValue != null">Max_Value = #{maxValue},</if>
|
||||
<if test="collectTime != null">Collect_Time = #{collectTime},</if>
|
||||
</trim>
|
||||
where Sensor_Id = #{sensorId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRecordAlarmBySensorId" parameterType="String">
|
||||
delete from record_alarm where Sensor_Id = #{sensorId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRecordAlarmBySensorIds" parameterType="String">
|
||||
delete from record_alarm where Sensor_Id in
|
||||
<foreach item="sensorId" collection="array" open="(" separator="," close=")">
|
||||
#{sensorId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue