add - 传感器报警设置
parent
addfa210a4
commit
623f9c824c
@ -0,0 +1,126 @@
|
||||
package com.ruoyi.web.controller.base;
|
||||
|
||||
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.BaseAlarmInfo;
|
||||
import com.ruoyi.system.service.IBaseAlarmInfoService;
|
||||
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-02-14
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/base/alarmInfo")
|
||||
public class BaseAlarmInfoController extends BaseController
|
||||
{
|
||||
private String prefix = "base/alarmInfo";
|
||||
|
||||
@Autowired
|
||||
private IBaseAlarmInfoService baseAlarmInfoService;
|
||||
|
||||
@RequiresPermissions("base:alarmInfo:view")
|
||||
@GetMapping()
|
||||
public String alarmInfo()
|
||||
{
|
||||
return prefix + "/alarmInfo";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询传感器报警信息列表
|
||||
*/
|
||||
@RequiresPermissions("base:alarmInfo:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(BaseAlarmInfo baseAlarmInfo)
|
||||
{
|
||||
startPage();
|
||||
List<BaseAlarmInfo> list = baseAlarmInfoService.selectBaseAlarmInfoList(baseAlarmInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出传感器报警信息列表
|
||||
*/
|
||||
@RequiresPermissions("base:alarmInfo:export")
|
||||
@Log(title = "传感器报警信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(BaseAlarmInfo baseAlarmInfo)
|
||||
{
|
||||
List<BaseAlarmInfo> list = baseAlarmInfoService.selectBaseAlarmInfoList(baseAlarmInfo);
|
||||
ExcelUtil<BaseAlarmInfo> util = new ExcelUtil<BaseAlarmInfo>(BaseAlarmInfo.class);
|
||||
return util.exportExcel(list, "传感器报警信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增传感器报警信息
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存传感器报警信息
|
||||
*/
|
||||
@RequiresPermissions("base:alarmInfo:add")
|
||||
@Log(title = "传感器报警信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(BaseAlarmInfo baseAlarmInfo)
|
||||
{
|
||||
return toAjax(baseAlarmInfoService.insertBaseAlarmInfo(baseAlarmInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改传感器报警信息
|
||||
*/
|
||||
@GetMapping("/edit/{objId}")
|
||||
public String edit(@PathVariable("objId") Long objId, ModelMap mmap)
|
||||
{
|
||||
BaseAlarmInfo baseAlarmInfo = baseAlarmInfoService.selectBaseAlarmInfoByObjId(objId);
|
||||
mmap.put("baseAlarmInfo", baseAlarmInfo);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存传感器报警信息
|
||||
*/
|
||||
@RequiresPermissions("base:alarmInfo:edit")
|
||||
@Log(title = "传感器报警信息", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(BaseAlarmInfo baseAlarmInfo)
|
||||
{
|
||||
return toAjax(baseAlarmInfoService.updateBaseAlarmInfo(baseAlarmInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除传感器报警信息
|
||||
*/
|
||||
@RequiresPermissions("base:alarmInfo:remove")
|
||||
@Log(title = "传感器报警信息", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(baseAlarmInfoService.deleteBaseAlarmInfoByObjIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,161 @@
|
||||
package com.ruoyi.web.controller.base;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
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.BaseAlarmType;
|
||||
import com.ruoyi.system.service.IBaseAlarmTypeService;
|
||||
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.utils.StringUtils;
|
||||
import com.ruoyi.common.core.domain.Ztree;
|
||||
|
||||
/**
|
||||
* 传感器报警类型Controller
|
||||
*
|
||||
* @author wenjy
|
||||
* @date 2022-02-14
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/base/alarmType")
|
||||
public class BaseAlarmTypeController extends BaseController
|
||||
{
|
||||
private String prefix = "base/alarmType";
|
||||
|
||||
@Autowired
|
||||
private IBaseAlarmTypeService baseAlarmTypeService;
|
||||
|
||||
@RequiresPermissions("base:alarmType:view")
|
||||
@GetMapping()
|
||||
public String alarmType()
|
||||
{
|
||||
return prefix + "/alarmType";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询传感器报警类型树列表
|
||||
*/
|
||||
@RequiresPermissions("base:alarmType:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public List<BaseAlarmType> list(BaseAlarmType baseAlarmType)
|
||||
{
|
||||
List<BaseAlarmType> list = baseAlarmTypeService.selectBaseAlarmTypeList(baseAlarmType);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出传感器报警类型列表
|
||||
*/
|
||||
@RequiresPermissions("base:alarmType:export")
|
||||
@Log(title = "传感器报警类型", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(BaseAlarmType baseAlarmType)
|
||||
{
|
||||
List<BaseAlarmType> list = baseAlarmTypeService.selectBaseAlarmTypeList(baseAlarmType);
|
||||
ExcelUtil<BaseAlarmType> util = new ExcelUtil<BaseAlarmType>(BaseAlarmType.class);
|
||||
return util.exportExcel(list, "传感器报警类型数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增传感器报警类型
|
||||
*/
|
||||
@GetMapping(value = { "/add/{objId}", "/add/" })
|
||||
public String add(@PathVariable(value = "objId", required = false) Long objId, ModelMap mmap)
|
||||
{
|
||||
if (StringUtils.isNotNull(objId))
|
||||
{
|
||||
mmap.put("baseAlarmType", baseAlarmTypeService.selectBaseAlarmTypeByObjId(objId));
|
||||
}
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存传感器报警类型
|
||||
*/
|
||||
@RequiresPermissions("base:alarmType:add")
|
||||
@Log(title = "传感器报警类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(BaseAlarmType baseAlarmType)
|
||||
{
|
||||
baseAlarmType.setCreateBy(ShiroUtils.getLoginName());
|
||||
baseAlarmType.setCreateTime(new Date());
|
||||
return toAjax(baseAlarmTypeService.insertBaseAlarmType(baseAlarmType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改传感器报警类型
|
||||
*/
|
||||
@GetMapping("/edit/{objId}")
|
||||
public String edit(@PathVariable("objId") Long objId, ModelMap mmap)
|
||||
{
|
||||
BaseAlarmType baseAlarmType = baseAlarmTypeService.selectBaseAlarmTypeByObjId(objId);
|
||||
mmap.put("baseAlarmType", baseAlarmType);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存传感器报警类型
|
||||
*/
|
||||
@RequiresPermissions("base:alarmType:edit")
|
||||
@Log(title = "传感器报警类型", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(BaseAlarmType baseAlarmType)
|
||||
{
|
||||
baseAlarmType.setUpdateBy(ShiroUtils.getLoginName());
|
||||
baseAlarmType.setUpdateTime(new Date());
|
||||
return toAjax(baseAlarmTypeService.updateBaseAlarmType(baseAlarmType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequiresPermissions("base:alarmType:remove")
|
||||
@Log(title = "传感器报警类型", businessType = BusinessType.DELETE)
|
||||
@GetMapping("/remove/{objId}")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(@PathVariable("objId") Long objId)
|
||||
{
|
||||
return toAjax(baseAlarmTypeService.deleteBaseAlarmTypeByObjId(objId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择传感器报警类型树
|
||||
*/
|
||||
@GetMapping(value = { "/selectAlarmTypeTree/{objId}", "/selectAlarmTypeTree/" })
|
||||
public String selectAlarmTypeTree(@PathVariable(value = "objId", required = false) Long objId, ModelMap mmap)
|
||||
{
|
||||
if (StringUtils.isNotNull(objId))
|
||||
{
|
||||
mmap.put("baseAlarmType", baseAlarmTypeService.selectBaseAlarmTypeByObjId(objId));
|
||||
}
|
||||
return prefix + "/tree";
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载传感器报警类型树列表
|
||||
*/
|
||||
@GetMapping("/treeData")
|
||||
@ResponseBody
|
||||
public List<Ztree> treeData()
|
||||
{
|
||||
List<Ztree> ztrees = baseAlarmTypeService.selectBaseAlarmTypeTree();
|
||||
return ztrees;
|
||||
}
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
<!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>
|
||||
<select name="enableFlag" th:with="type=${@dict.getType('enable_flag')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</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="base:alarmInfo:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="base:alarmInfo:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="base:alarmInfo:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="base:alarmInfo: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('base:alarmInfo:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('base:alarmInfo:remove')}]];
|
||||
var enableFlagDatas = [[${@dict.getType('enable_flag')}]];
|
||||
var prefix = ctx + "base/alarmInfo";
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "传感器报警信息",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'objId',
|
||||
title: '主键标识',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'sensorId',
|
||||
title: '传感器编号'
|
||||
},
|
||||
{
|
||||
field: 'alarmtypeId',
|
||||
title: '报警类型编号'
|
||||
},
|
||||
{
|
||||
field: 'maxValue',
|
||||
title: '阈值(最大)'
|
||||
},
|
||||
{
|
||||
field: 'minValue',
|
||||
title: '阈值(最小)'
|
||||
},
|
||||
{
|
||||
field: 'enableFlag',
|
||||
title: '是否启用',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(enableFlagDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createBy',
|
||||
title: '创建人'
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间'
|
||||
},
|
||||
{
|
||||
field: 'updateBy',
|
||||
title: '更新人'
|
||||
},
|
||||
{
|
||||
field: 'updateTime',
|
||||
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.objId + '\')"><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.objId + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,73 @@
|
||||
<!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-alarmType-add">
|
||||
<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="alarmtypeName" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">父级编号:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="treeId" name="parentId" type="hidden" th:value="${baseAlarmType?.alarmtypeId}"/>
|
||||
<input class="form-control" type="text" onclick="selectAlarmTypeTree()" id="treeName" readonly="true" th:value="${baseAlarmType?.alarmtypeName}">
|
||||
<span class="input-group-addon"><i class="fa fa-search"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否启用:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="enableFlag" class="form-control m-b" th:with="type=${@dict.getType('enable_flag')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "base/alarmType"
|
||||
$("#form-alarmType-add").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-alarmType-add').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
/*传感器报警类型-新增-选择父传感器报警类型树*/
|
||||
function selectAlarmTypeTree() {
|
||||
var options = {
|
||||
title: '传感器报警类型选择',
|
||||
width: "380",
|
||||
url: prefix + "/selectAlarmTypeTree/" + $("#treeId").val(),
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
}
|
||||
|
||||
function doSubmit(index, layero){
|
||||
var body = $.modal.getChildFrame(index);
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
$.modal.close(index);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,142 @@
|
||||
<!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="alarmtypeId"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>类型名称:</label>
|
||||
<input type="text" name="alarmtypeName"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>是否启用:</label>
|
||||
<select name="enableFlag" th:with="type=${@dict.getType('enable_flag')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.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="base:alarmType:add">
|
||||
<i class="fa fa-plus"></i> 新增
|
||||
</a>
|
||||
<a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="base:alarmType:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-info" id="expandAllBtn">
|
||||
<i class="fa fa-exchange"></i> 展开/折叠
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-tree-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var addFlag = [[${@permission.hasPermi('base:alarmType:add')}]];
|
||||
var editFlag = [[${@permission.hasPermi('base:alarmType:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('base:alarmType:remove')}]];
|
||||
var enableFlagDatas = [[${@dict.getType('enable_flag')}]];
|
||||
var prefix = ctx + "base/alarmType";
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
code: "alarmtypeId",
|
||||
parentCode: "parentId",
|
||||
expandColumn: "2",
|
||||
uniqueId: "objId",
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add/{id}",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove/{id}",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "传感器报警类型",
|
||||
columns: [{
|
||||
field: 'selectItem',
|
||||
radio: true
|
||||
},
|
||||
{
|
||||
field: 'alarmtypeId',
|
||||
title: '类型编号',
|
||||
align: 'left'
|
||||
},
|
||||
{
|
||||
field: 'alarmtypeName',
|
||||
title: '类型名称',
|
||||
align: 'left',
|
||||
width:'150'
|
||||
},
|
||||
{
|
||||
field: 'parentId',
|
||||
title: '父级编号',
|
||||
align: 'left',
|
||||
visible:false,
|
||||
},
|
||||
{
|
||||
field: 'enableFlag',
|
||||
title: '是否启用',
|
||||
align: 'left',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(enableFlagDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createBy',
|
||||
title: '创建人',
|
||||
align: 'left'
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
align: 'left',
|
||||
width:'150'
|
||||
},
|
||||
{
|
||||
field: 'updateBy',
|
||||
title: '更新人',
|
||||
align: 'left'
|
||||
},
|
||||
{
|
||||
field: 'updateTime',
|
||||
title: '更新时间',
|
||||
align: 'left',
|
||||
width:'150'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
align: 'left',
|
||||
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.objId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.objId + '\')"><i class="fa fa-plus"></i>新增</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.objId + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.treeTable.init(options);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,74 @@
|
||||
<!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-alarmType-edit" th:object="${baseAlarmType}">
|
||||
<input name="objId" th:field="*{objId}" type="hidden">
|
||||
<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="alarmtypeName" th:field="*{alarmtypeName}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">父级编号:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="treeId" name="parentId" type="hidden" th:field="*{parentId}" />
|
||||
<input class="form-control" type="text" onclick="selectAlarmTypeTree()" id="treeName" readonly="true" th:field="*{parentName}">
|
||||
<span class="input-group-addon"><i class="fa fa-search"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否启用:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="enableFlag" class="form-control m-b" th:with="type=${@dict.getType('enable_flag')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{enableFlag}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "base/alarmType";
|
||||
$("#form-alarmType-edit").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-alarmType-edit').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
/*传感器报警类型-编辑-选择父传感器报警类型树*/
|
||||
function selectAlarmTypeTree() {
|
||||
var options = {
|
||||
title: '传感器报警类型选择',
|
||||
width: "380",
|
||||
url: prefix + "/selectAlarmTypeTree/" + $("#treeId").val(),
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
}
|
||||
|
||||
function doSubmit(index, layero){
|
||||
var body = $.modal.getChildFrame(index);
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
$.modal.close(index);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('传感器报警类型树选择')" />
|
||||
<th:block th:include="include :: ztree-css" />
|
||||
</head>
|
||||
<style>
|
||||
body{height:auto;font-family: "Microsoft YaHei";}
|
||||
button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
|
||||
</style>
|
||||
<body class="hold-transition box box-main">
|
||||
<input id="treeId" name="treeId" type="hidden" th:value="${baseAlarmType?.alarmtypeId}"/>
|
||||
<input id="treeName" name="treeName" type="hidden" th:value="${baseAlarmType?.alarmtypeName}"/>
|
||||
<div class="wrapper"><div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
|
||||
<label id="btnShow" title="显示搜索" style="display:none;">︾</label>
|
||||
<label id="btnHide" title="隐藏搜索">︽</label>
|
||||
</div>
|
||||
<div class="treeSearchInput" id="search">
|
||||
<label for="keyword">关键字:</label><input type="text" class="empty" id="keyword" maxlength="50">
|
||||
<button class="btn" id="btn" onclick="$.tree.searchNode()"> 搜索 </button>
|
||||
</div>
|
||||
<div class="treeExpandCollapse">
|
||||
<a href="#" onclick="$.tree.expand()">展开</a> /
|
||||
<a href="#" onclick="$.tree.collapse()">折叠</a>
|
||||
</div>
|
||||
<div id="tree" class="ztree treeselect"></div>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: ztree-js" />
|
||||
<script th:inline="javascript">
|
||||
$(function() {
|
||||
var url = ctx + "base/alarmType/treeData";
|
||||
var options = {
|
||||
url: url,
|
||||
expandLevel: 2,
|
||||
onClick : zOnClick
|
||||
};
|
||||
$.tree.init(options);
|
||||
});
|
||||
|
||||
function zOnClick(event, treeId, treeNode) {
|
||||
var treeId = treeNode.id;
|
||||
var treeName = treeNode.name;
|
||||
$("#treeId").val(treeId);
|
||||
$("#treeName").val(treeName);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,112 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 传感器报警信息对象 base_alarm_info
|
||||
*
|
||||
* @author wenjy
|
||||
* @date 2022-02-14
|
||||
*/
|
||||
public class BaseAlarmInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键标识 */
|
||||
private Long objId;
|
||||
|
||||
/** 传感器编号 */
|
||||
@Excel(name = "传感器编号")
|
||||
private String sensorId;
|
||||
|
||||
/** 报警类型编号 */
|
||||
@Excel(name = "报警类型编号")
|
||||
private String alarmtypeId;
|
||||
|
||||
/** 阈值(最大) */
|
||||
@Excel(name = "阈值(最大)")
|
||||
private BigDecimal maxValue;
|
||||
|
||||
/** 阈值(最小) */
|
||||
@Excel(name = "阈值(最小)")
|
||||
private String minValue;
|
||||
|
||||
/** 是否启用 */
|
||||
@Excel(name = "是否启用")
|
||||
private Long enableFlag;
|
||||
|
||||
public void setObjId(Long objId)
|
||||
{
|
||||
this.objId = objId;
|
||||
}
|
||||
|
||||
public Long getObjId()
|
||||
{
|
||||
return objId;
|
||||
}
|
||||
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 setMaxValue(BigDecimal maxValue)
|
||||
{
|
||||
this.maxValue = maxValue;
|
||||
}
|
||||
|
||||
public BigDecimal getMaxValue()
|
||||
{
|
||||
return maxValue;
|
||||
}
|
||||
public void setMinValue(String minValue)
|
||||
{
|
||||
this.minValue = minValue;
|
||||
}
|
||||
|
||||
public String getMinValue()
|
||||
{
|
||||
return minValue;
|
||||
}
|
||||
public void setEnableFlag(Long enableFlag)
|
||||
{
|
||||
this.enableFlag = enableFlag;
|
||||
}
|
||||
|
||||
public Long getEnableFlag()
|
||||
{
|
||||
return enableFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("objId", getObjId())
|
||||
.append("sensorId", getSensorId())
|
||||
.append("alarmtypeId", getAlarmtypeId())
|
||||
.append("maxValue", getMaxValue())
|
||||
.append("minValue", getMinValue())
|
||||
.append("enableFlag", getEnableFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
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.TreeEntity;
|
||||
|
||||
/**
|
||||
* 传感器报警类型对象 base_alarm_type
|
||||
*
|
||||
* @author wenjy
|
||||
* @date 2022-02-14
|
||||
*/
|
||||
public class BaseAlarmType extends TreeEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键标识 */
|
||||
private Long objId;
|
||||
|
||||
/** 报警类型编号 */
|
||||
@Excel(name = "报警类型编号")
|
||||
private String alarmtypeId;
|
||||
|
||||
/** 报警类型名称 */
|
||||
@Excel(name = "报警类型名称")
|
||||
private String alarmtypeName;
|
||||
|
||||
/** 是否启用 */
|
||||
@Excel(name = "是否启用")
|
||||
private Long enableFlag;
|
||||
|
||||
public void setObjId(Long objId)
|
||||
{
|
||||
this.objId = objId;
|
||||
}
|
||||
|
||||
public Long getObjId()
|
||||
{
|
||||
return objId;
|
||||
}
|
||||
public void setAlarmtypeId(String alarmtypeId)
|
||||
{
|
||||
this.alarmtypeId = alarmtypeId;
|
||||
}
|
||||
|
||||
public String getAlarmtypeId()
|
||||
{
|
||||
return alarmtypeId;
|
||||
}
|
||||
public void setAlarmtypeName(String alarmtypeName)
|
||||
{
|
||||
this.alarmtypeName = alarmtypeName;
|
||||
}
|
||||
|
||||
public String getAlarmtypeName()
|
||||
{
|
||||
return alarmtypeName;
|
||||
}
|
||||
public void setEnableFlag(Long enableFlag)
|
||||
{
|
||||
this.enableFlag = enableFlag;
|
||||
}
|
||||
|
||||
public Long getEnableFlag()
|
||||
{
|
||||
return enableFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("objId", getObjId())
|
||||
.append("alarmtypeId", getAlarmtypeId())
|
||||
.append("alarmtypeName", getAlarmtypeName())
|
||||
.append("parentId", getParentId())
|
||||
.append("enableFlag", getEnableFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.BaseAlarmInfo;
|
||||
|
||||
/**
|
||||
* 传感器报警信息Mapper接口
|
||||
*
|
||||
* @author wenjy
|
||||
* @date 2022-02-14
|
||||
*/
|
||||
public interface BaseAlarmInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询传感器报警信息
|
||||
*
|
||||
* @param objId 传感器报警信息主键
|
||||
* @return 传感器报警信息
|
||||
*/
|
||||
public BaseAlarmInfo selectBaseAlarmInfoByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询传感器报警信息列表
|
||||
*
|
||||
* @param baseAlarmInfo 传感器报警信息
|
||||
* @return 传感器报警信息集合
|
||||
*/
|
||||
public List<BaseAlarmInfo> selectBaseAlarmInfoList(BaseAlarmInfo baseAlarmInfo);
|
||||
|
||||
/**
|
||||
* 新增传感器报警信息
|
||||
*
|
||||
* @param baseAlarmInfo 传感器报警信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseAlarmInfo(BaseAlarmInfo baseAlarmInfo);
|
||||
|
||||
/**
|
||||
* 修改传感器报警信息
|
||||
*
|
||||
* @param baseAlarmInfo 传感器报警信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseAlarmInfo(BaseAlarmInfo baseAlarmInfo);
|
||||
|
||||
/**
|
||||
* 删除传感器报警信息
|
||||
*
|
||||
* @param objId 传感器报警信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseAlarmInfoByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 批量删除传感器报警信息
|
||||
*
|
||||
* @param objIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseAlarmInfoByObjIds(String[] objIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.BaseAlarmType;
|
||||
|
||||
/**
|
||||
* 传感器报警类型Mapper接口
|
||||
*
|
||||
* @author wenjy
|
||||
* @date 2022-02-14
|
||||
*/
|
||||
public interface BaseAlarmTypeMapper
|
||||
{
|
||||
/**
|
||||
* 查询传感器报警类型
|
||||
*
|
||||
* @param objId 传感器报警类型主键
|
||||
* @return 传感器报警类型
|
||||
*/
|
||||
public BaseAlarmType selectBaseAlarmTypeByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询传感器报警类型列表
|
||||
*
|
||||
* @param baseAlarmType 传感器报警类型
|
||||
* @return 传感器报警类型集合
|
||||
*/
|
||||
public List<BaseAlarmType> selectBaseAlarmTypeList(BaseAlarmType baseAlarmType);
|
||||
|
||||
/**
|
||||
* 新增传感器报警类型
|
||||
*
|
||||
* @param baseAlarmType 传感器报警类型
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseAlarmType(BaseAlarmType baseAlarmType);
|
||||
|
||||
/**
|
||||
* 修改传感器报警类型
|
||||
*
|
||||
* @param baseAlarmType 传感器报警类型
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseAlarmType(BaseAlarmType baseAlarmType);
|
||||
|
||||
/**
|
||||
* 删除传感器报警类型
|
||||
*
|
||||
* @param objId 传感器报警类型主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseAlarmTypeByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 批量删除传感器报警类型
|
||||
*
|
||||
* @param objIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseAlarmTypeByObjIds(String[] objIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.BaseAlarmInfo;
|
||||
|
||||
/**
|
||||
* 传感器报警信息Service接口
|
||||
*
|
||||
* @author wenjy
|
||||
* @date 2022-02-14
|
||||
*/
|
||||
public interface IBaseAlarmInfoService
|
||||
{
|
||||
/**
|
||||
* 查询传感器报警信息
|
||||
*
|
||||
* @param objId 传感器报警信息主键
|
||||
* @return 传感器报警信息
|
||||
*/
|
||||
public BaseAlarmInfo selectBaseAlarmInfoByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询传感器报警信息列表
|
||||
*
|
||||
* @param baseAlarmInfo 传感器报警信息
|
||||
* @return 传感器报警信息集合
|
||||
*/
|
||||
public List<BaseAlarmInfo> selectBaseAlarmInfoList(BaseAlarmInfo baseAlarmInfo);
|
||||
|
||||
/**
|
||||
* 新增传感器报警信息
|
||||
*
|
||||
* @param baseAlarmInfo 传感器报警信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseAlarmInfo(BaseAlarmInfo baseAlarmInfo);
|
||||
|
||||
/**
|
||||
* 修改传感器报警信息
|
||||
*
|
||||
* @param baseAlarmInfo 传感器报警信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseAlarmInfo(BaseAlarmInfo baseAlarmInfo);
|
||||
|
||||
/**
|
||||
* 批量删除传感器报警信息
|
||||
*
|
||||
* @param objIds 需要删除的传感器报警信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseAlarmInfoByObjIds(String objIds);
|
||||
|
||||
/**
|
||||
* 删除传感器报警信息信息
|
||||
*
|
||||
* @param objId 传感器报警信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseAlarmInfoByObjId(Long objId);
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.BaseAlarmType;
|
||||
import com.ruoyi.common.core.domain.Ztree;
|
||||
|
||||
/**
|
||||
* 传感器报警类型Service接口
|
||||
*
|
||||
* @author wenjy
|
||||
* @date 2022-02-14
|
||||
*/
|
||||
public interface IBaseAlarmTypeService
|
||||
{
|
||||
/**
|
||||
* 查询传感器报警类型
|
||||
*
|
||||
* @param objId 传感器报警类型主键
|
||||
* @return 传感器报警类型
|
||||
*/
|
||||
public BaseAlarmType selectBaseAlarmTypeByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询传感器报警类型列表
|
||||
*
|
||||
* @param baseAlarmType 传感器报警类型
|
||||
* @return 传感器报警类型集合
|
||||
*/
|
||||
public List<BaseAlarmType> selectBaseAlarmTypeList(BaseAlarmType baseAlarmType);
|
||||
|
||||
/**
|
||||
* 新增传感器报警类型
|
||||
*
|
||||
* @param baseAlarmType 传感器报警类型
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseAlarmType(BaseAlarmType baseAlarmType);
|
||||
|
||||
/**
|
||||
* 修改传感器报警类型
|
||||
*
|
||||
* @param baseAlarmType 传感器报警类型
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseAlarmType(BaseAlarmType baseAlarmType);
|
||||
|
||||
/**
|
||||
* 批量删除传感器报警类型
|
||||
*
|
||||
* @param objIds 需要删除的传感器报警类型主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseAlarmTypeByObjIds(String objIds);
|
||||
|
||||
/**
|
||||
* 删除传感器报警类型信息
|
||||
*
|
||||
* @param objId 传感器报警类型主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseAlarmTypeByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询传感器报警类型树列表
|
||||
*
|
||||
* @return 所有传感器报警类型信息
|
||||
*/
|
||||
public List<Ztree> selectBaseAlarmTypeTree();
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.BaseAlarmInfoMapper;
|
||||
import com.ruoyi.system.domain.BaseAlarmInfo;
|
||||
import com.ruoyi.system.service.IBaseAlarmInfoService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 传感器报警信息Service业务层处理
|
||||
*
|
||||
* @author wenjy
|
||||
* @date 2022-02-14
|
||||
*/
|
||||
@Service
|
||||
public class BaseAlarmInfoServiceImpl implements IBaseAlarmInfoService
|
||||
{
|
||||
@Autowired
|
||||
private BaseAlarmInfoMapper baseAlarmInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询传感器报警信息
|
||||
*
|
||||
* @param objId 传感器报警信息主键
|
||||
* @return 传感器报警信息
|
||||
*/
|
||||
@Override
|
||||
public BaseAlarmInfo selectBaseAlarmInfoByObjId(Long objId)
|
||||
{
|
||||
return baseAlarmInfoMapper.selectBaseAlarmInfoByObjId(objId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询传感器报警信息列表
|
||||
*
|
||||
* @param baseAlarmInfo 传感器报警信息
|
||||
* @return 传感器报警信息
|
||||
*/
|
||||
@Override
|
||||
public List<BaseAlarmInfo> selectBaseAlarmInfoList(BaseAlarmInfo baseAlarmInfo)
|
||||
{
|
||||
return baseAlarmInfoMapper.selectBaseAlarmInfoList(baseAlarmInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增传感器报警信息
|
||||
*
|
||||
* @param baseAlarmInfo 传感器报警信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBaseAlarmInfo(BaseAlarmInfo baseAlarmInfo)
|
||||
{
|
||||
baseAlarmInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return baseAlarmInfoMapper.insertBaseAlarmInfo(baseAlarmInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改传感器报警信息
|
||||
*
|
||||
* @param baseAlarmInfo 传感器报警信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBaseAlarmInfo(BaseAlarmInfo baseAlarmInfo)
|
||||
{
|
||||
baseAlarmInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return baseAlarmInfoMapper.updateBaseAlarmInfo(baseAlarmInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除传感器报警信息
|
||||
*
|
||||
* @param objIds 需要删除的传感器报警信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseAlarmInfoByObjIds(String objIds)
|
||||
{
|
||||
return baseAlarmInfoMapper.deleteBaseAlarmInfoByObjIds(Convert.toStrArray(objIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除传感器报警信息信息
|
||||
*
|
||||
* @param objId 传感器报警信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseAlarmInfoByObjId(Long objId)
|
||||
{
|
||||
return baseAlarmInfoMapper.deleteBaseAlarmInfoByObjId(objId);
|
||||
}
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import com.ruoyi.common.core.domain.Ztree;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.BaseAlarmTypeMapper;
|
||||
import com.ruoyi.system.domain.BaseAlarmType;
|
||||
import com.ruoyi.system.service.IBaseAlarmTypeService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 传感器报警类型Service业务层处理
|
||||
*
|
||||
* @author wenjy
|
||||
* @date 2022-02-14
|
||||
*/
|
||||
@Service
|
||||
public class BaseAlarmTypeServiceImpl implements IBaseAlarmTypeService
|
||||
{
|
||||
@Autowired
|
||||
private BaseAlarmTypeMapper baseAlarmTypeMapper;
|
||||
|
||||
/**
|
||||
* 查询传感器报警类型
|
||||
*
|
||||
* @param objId 传感器报警类型主键
|
||||
* @return 传感器报警类型
|
||||
*/
|
||||
@Override
|
||||
public BaseAlarmType selectBaseAlarmTypeByObjId(Long objId)
|
||||
{
|
||||
return baseAlarmTypeMapper.selectBaseAlarmTypeByObjId(objId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询传感器报警类型列表
|
||||
*
|
||||
* @param baseAlarmType 传感器报警类型
|
||||
* @return 传感器报警类型
|
||||
*/
|
||||
@Override
|
||||
public List<BaseAlarmType> selectBaseAlarmTypeList(BaseAlarmType baseAlarmType)
|
||||
{
|
||||
return baseAlarmTypeMapper.selectBaseAlarmTypeList(baseAlarmType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增传感器报警类型
|
||||
*
|
||||
* @param baseAlarmType 传感器报警类型
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBaseAlarmType(BaseAlarmType baseAlarmType)
|
||||
{
|
||||
baseAlarmType.setCreateTime(DateUtils.getNowDate());
|
||||
return baseAlarmTypeMapper.insertBaseAlarmType(baseAlarmType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改传感器报警类型
|
||||
*
|
||||
* @param baseAlarmType 传感器报警类型
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBaseAlarmType(BaseAlarmType baseAlarmType)
|
||||
{
|
||||
baseAlarmType.setUpdateTime(DateUtils.getNowDate());
|
||||
return baseAlarmTypeMapper.updateBaseAlarmType(baseAlarmType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除传感器报警类型
|
||||
*
|
||||
* @param objIds 需要删除的传感器报警类型主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseAlarmTypeByObjIds(String objIds)
|
||||
{
|
||||
return baseAlarmTypeMapper.deleteBaseAlarmTypeByObjIds(Convert.toStrArray(objIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除传感器报警类型信息
|
||||
*
|
||||
* @param objId 传感器报警类型主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseAlarmTypeByObjId(Long objId)
|
||||
{
|
||||
return baseAlarmTypeMapper.deleteBaseAlarmTypeByObjId(objId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询传感器报警类型树列表
|
||||
*
|
||||
* @return 所有传感器报警类型信息
|
||||
*/
|
||||
@Override
|
||||
public List<Ztree> selectBaseAlarmTypeTree()
|
||||
{
|
||||
List<BaseAlarmType> baseAlarmTypeList = baseAlarmTypeMapper.selectBaseAlarmTypeList(new BaseAlarmType());
|
||||
List<Ztree> ztrees = new ArrayList<Ztree>();
|
||||
for (BaseAlarmType baseAlarmType : baseAlarmTypeList)
|
||||
{
|
||||
Ztree ztree = new Ztree();
|
||||
ztree.setId(baseAlarmType.getAlarmtypeId());
|
||||
ztree.setpId(baseAlarmType.getParentId());
|
||||
ztree.setName(baseAlarmType.getAlarmtypeName());
|
||||
ztree.setTitle(baseAlarmType.getAlarmtypeName());
|
||||
ztrees.add(ztree);
|
||||
}
|
||||
return ztrees;
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
<?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.BaseAlarmInfoMapper">
|
||||
|
||||
<resultMap type="BaseAlarmInfo" id="BaseAlarmInfoResult">
|
||||
<result property="objId" column="ObjId" />
|
||||
<result property="sensorId" column="Sensor_Id" />
|
||||
<result property="alarmtypeId" column="AlarmType_Id" />
|
||||
<result property="maxValue" column="Max_Value" />
|
||||
<result property="minValue" column="Min_Value" />
|
||||
<result property="enableFlag" column="Enable_Flag" />
|
||||
<result property="createBy" column="Create_By" />
|
||||
<result property="createTime" column="Create_Time" />
|
||||
<result property="updateBy" column="Update_By" />
|
||||
<result property="updateTime" column="Update_Time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBaseAlarmInfoVo">
|
||||
select ObjId, Sensor_Id, AlarmType_Id, Max_Value, Min_Value, Enable_Flag, Create_By, Create_Time, Update_By, Update_Time from base_alarm_info
|
||||
</sql>
|
||||
|
||||
<select id="selectBaseAlarmInfoList" parameterType="BaseAlarmInfo" resultMap="BaseAlarmInfoResult">
|
||||
<include refid="selectBaseAlarmInfoVo"/>
|
||||
<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="maxValue != null "> and Max_Value = #{maxValue}</if>
|
||||
<if test="minValue != null and minValue != ''"> and Min_Value = #{minValue}</if>
|
||||
<if test="enableFlag != null "> and Enable_Flag = #{enableFlag}</if>
|
||||
<if test="createBy != null and createBy != ''"> and Create_By = #{createBy}</if>
|
||||
<if test="createTime != null "> and Create_Time = #{createTime}</if>
|
||||
<if test="updateBy != null and updateBy != ''"> and Update_By = #{updateBy}</if>
|
||||
<if test="updateTime != null "> and Update_Time = #{updateTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBaseAlarmInfoByObjId" parameterType="Long" resultMap="BaseAlarmInfoResult">
|
||||
<include refid="selectBaseAlarmInfoVo"/>
|
||||
where ObjId = #{objId}
|
||||
</select>
|
||||
|
||||
<insert id="insertBaseAlarmInfo" parameterType="BaseAlarmInfo" useGeneratedKeys="true" keyProperty="objId">
|
||||
insert into base_alarm_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sensorId != null">Sensor_Id,</if>
|
||||
<if test="alarmtypeId != null">AlarmType_Id,</if>
|
||||
<if test="maxValue != null">Max_Value,</if>
|
||||
<if test="minValue != null">Min_Value,</if>
|
||||
<if test="enableFlag != null">Enable_Flag,</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="sensorId != null">#{sensorId},</if>
|
||||
<if test="alarmtypeId != null">#{alarmtypeId},</if>
|
||||
<if test="maxValue != null">#{maxValue},</if>
|
||||
<if test="minValue != null">#{minValue},</if>
|
||||
<if test="enableFlag != null">#{enableFlag},</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="updateBaseAlarmInfo" parameterType="BaseAlarmInfo">
|
||||
update base_alarm_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sensorId != null">Sensor_Id = #{sensorId},</if>
|
||||
<if test="alarmtypeId != null">AlarmType_Id = #{alarmtypeId},</if>
|
||||
<if test="maxValue != null">Max_Value = #{maxValue},</if>
|
||||
<if test="minValue != null">Min_Value = #{minValue},</if>
|
||||
<if test="enableFlag != null">Enable_Flag = #{enableFlag},</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 ObjId = #{objId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBaseAlarmInfoByObjId" parameterType="Long">
|
||||
delete from base_alarm_info where ObjId = #{objId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBaseAlarmInfoByObjIds" parameterType="String">
|
||||
delete from base_alarm_info where ObjId in
|
||||
<foreach item="objId" collection="array" open="(" separator="," close=")">
|
||||
#{objId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,96 @@
|
||||
<?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.BaseAlarmTypeMapper">
|
||||
|
||||
<resultMap type="BaseAlarmType" id="BaseAlarmTypeResult">
|
||||
<result property="objId" column="ObjId" />
|
||||
<result property="alarmtypeId" column="alarmType_Id" />
|
||||
<result property="alarmtypeName" column="alarmType_Name" />
|
||||
<result property="parentId" column="parent_Id" />
|
||||
<result property="enableFlag" column="Enable_Flag" />
|
||||
<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="parentName" column="parent_name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBaseAlarmTypeVo">
|
||||
select ObjId, alarmType_Id, alarmType_Name, parent_Id, Enable_Flag, Create_By, Create_Time, Update_By, Update_Time from base_alarm_type
|
||||
</sql>
|
||||
|
||||
<select id="selectBaseAlarmTypeList" parameterType="BaseAlarmType" resultMap="BaseAlarmTypeResult">
|
||||
<include refid="selectBaseAlarmTypeVo"/>
|
||||
<where>
|
||||
<if test="alarmtypeId != null and alarmtypeId != ''"> and alarmType_Id = #{alarmtypeId}</if>
|
||||
<if test="alarmtypeName != null and alarmtypeName != ''"> and alarmType_Name like concat('%', #{alarmtypeName}, '%')</if>
|
||||
<if test="parentId != null and parentId != ''"> and parent_Id = #{parentId}</if>
|
||||
<if test="enableFlag != null "> and Enable_Flag = #{enableFlag}</if>
|
||||
<if test="createBy != null and createBy != ''"> and Create_By = #{createBy}</if>
|
||||
<if test="createTime != null "> and Create_Time = #{createTime}</if>
|
||||
<if test="updateBy != null and updateBy != ''"> and Update_By = #{updateBy}</if>
|
||||
<if test="updateTime != null "> and Update_Time = #{updateTime}</if>
|
||||
</where>
|
||||
order by parent_Id
|
||||
</select>
|
||||
|
||||
<select id="selectBaseAlarmTypeByObjId" parameterType="Long" resultMap="BaseAlarmTypeResult">
|
||||
select t.ObjId, t.alarmType_Id, t.alarmType_Name, t.parent_Id, t.Enable_Flag, t.Create_By, t.Create_Time, t.Update_By, t.Update_Time, p.alarmType_Name as parent_name
|
||||
from base_alarm_type t
|
||||
left join base_alarm_type p on p.ObjId = t.parent_Id
|
||||
where t.ObjId = #{objId}
|
||||
</select>
|
||||
|
||||
<insert id="insertBaseAlarmType" parameterType="BaseAlarmType" useGeneratedKeys="true" keyProperty="objId">
|
||||
insert into base_alarm_type
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="alarmtypeId != null">alarmType_Id,</if>
|
||||
<if test="alarmtypeName != null">alarmType_Name,</if>
|
||||
<if test="parentId != null">parent_Id,</if>
|
||||
<if test="enableFlag != null">Enable_Flag,</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="alarmtypeId != null">#{alarmtypeId},</if>
|
||||
<if test="alarmtypeName != null">#{alarmtypeName},</if>
|
||||
<if test="parentId != null">#{parentId},</if>
|
||||
<if test="enableFlag != null">#{enableFlag},</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="updateBaseAlarmType" parameterType="BaseAlarmType">
|
||||
update base_alarm_type
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="alarmtypeId != null">alarmType_Id = #{alarmtypeId},</if>
|
||||
<if test="alarmtypeName != null">alarmType_Name = #{alarmtypeName},</if>
|
||||
<if test="parentId != null">parent_Id = #{parentId},</if>
|
||||
<if test="enableFlag != null">Enable_Flag = #{enableFlag},</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 ObjId = #{objId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBaseAlarmTypeByObjId" parameterType="Long">
|
||||
delete from base_alarm_type where ObjId = #{objId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBaseAlarmTypeByObjIds" parameterType="String">
|
||||
delete from base_alarm_type where ObjId in
|
||||
<foreach item="objId" collection="array" open="(" separator="," close=")">
|
||||
#{objId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue