add - 设备参数维护
parent
334922aa46
commit
c4e0a7c130
@ -0,0 +1,136 @@
|
||||
package com.ruoyi.web.controller.base;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
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.BaseDeviceParam;
|
||||
import com.ruoyi.system.service.IBaseDeviceParamService;
|
||||
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-24
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/base/deviceParam")
|
||||
public class BaseDeviceParamController extends BaseController
|
||||
{
|
||||
private String prefix = "base/deviceParam";
|
||||
|
||||
@Autowired
|
||||
private IBaseDeviceParamService baseDeviceParamService;
|
||||
|
||||
@RequiresPermissions("base:deviceParam:view")
|
||||
@GetMapping()
|
||||
public String deviceParam()
|
||||
{
|
||||
return prefix + "/deviceParam";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备参数列表
|
||||
*/
|
||||
@RequiresPermissions("base:deviceParam:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(BaseDeviceParam baseDeviceParam)
|
||||
{
|
||||
startPage();
|
||||
List<BaseDeviceParam> list = baseDeviceParamService.selectBaseDeviceParamList(baseDeviceParam);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/getParams")
|
||||
@ResponseBody
|
||||
public String getDeviceParams(String deviceId) {
|
||||
List<BaseDeviceParam> baseDeviceParams = baseDeviceParamService.selectBaseDeviceParamList(new BaseDeviceParam(deviceId, 0L));
|
||||
return JSONArray.toJSONString(baseDeviceParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备参数列表
|
||||
*/
|
||||
@RequiresPermissions("base:deviceParam:export")
|
||||
@Log(title = "设备参数", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(BaseDeviceParam baseDeviceParam)
|
||||
{
|
||||
List<BaseDeviceParam> list = baseDeviceParamService.selectBaseDeviceParamList(baseDeviceParam);
|
||||
ExcelUtil<BaseDeviceParam> util = new ExcelUtil<BaseDeviceParam>(BaseDeviceParam.class);
|
||||
return util.exportExcel(list, "设备参数数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备参数
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存设备参数
|
||||
*/
|
||||
@RequiresPermissions("base:deviceParam:add")
|
||||
@Log(title = "设备参数", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(BaseDeviceParam baseDeviceParam)
|
||||
{
|
||||
return toAjax(baseDeviceParamService.insertBaseDeviceParam(baseDeviceParam));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备参数
|
||||
*/
|
||||
@GetMapping("/edit/{ObjId}")
|
||||
public String edit(@PathVariable("ObjId") Long ObjId, ModelMap mmap)
|
||||
{
|
||||
BaseDeviceParam baseDeviceParam = baseDeviceParamService.selectBaseDeviceParamByObjId(ObjId);
|
||||
mmap.put("baseDeviceParam", baseDeviceParam);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存设备参数
|
||||
*/
|
||||
@RequiresPermissions("base:deviceParam:edit")
|
||||
@Log(title = "设备参数", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(BaseDeviceParam baseDeviceParam)
|
||||
{
|
||||
return toAjax(baseDeviceParamService.updateBaseDeviceParam(baseDeviceParam));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备参数
|
||||
*/
|
||||
@RequiresPermissions("base:deviceParam:remove")
|
||||
@Log(title = "设备参数", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(baseDeviceParamService.deleteBaseDeviceParamByObjIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
<!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-deviceParam-add">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">设备标识:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="deviceId" 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="paramTitle" 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="paramValue" class="form-control" type="text">
|
||||
</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/deviceParam"
|
||||
$("#form-deviceParam-add").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-deviceParam-add').serialize());
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,133 @@
|
||||
<!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="deviceId"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>参数标题:</label>
|
||||
<input type="text" name="paramTitle"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>参数值:</label>
|
||||
<input type="text" name="paramValue"/>
|
||||
</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:deviceParam:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="base:deviceParam:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="base:deviceParam:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="base:deviceParam: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:deviceParam:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('base:deviceParam:remove')}]];
|
||||
var enableFlagDatas = [[${@dict.getType('enable_flag')}]];
|
||||
var prefix = ctx + "base/deviceParam";
|
||||
|
||||
$(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: 'deviceId',
|
||||
title: '设备标识'
|
||||
},
|
||||
{
|
||||
field: 'paramTitle',
|
||||
title: '参数标题'
|
||||
},
|
||||
{
|
||||
field: 'paramValue',
|
||||
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,52 @@
|
||||
<!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-deviceParam-edit" th:object="${baseDeviceParam}">
|
||||
<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="deviceId" th:field="*{deviceId}" 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="paramTitle" th:field="*{paramTitle}" 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="paramValue" th:field="*{paramValue}" class="form-control" type="text">
|
||||
</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/deviceParam";
|
||||
$("#form-deviceParam-edit").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-deviceParam-edit').serialize());
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,124 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<th:block th:include="include :: header('设备参数')"/>
|
||||
<th:block th:include="include :: select2-css"/>
|
||||
|
||||
<th:block th:include="include :: datetimepicker-css"/>
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-device-param" th:object="${baseMonitorunitInfo}">
|
||||
<input name="objId" th:field="*{objId}" type="hidden">
|
||||
<input name="monitorunitId" type="hidden" th:field="*{monitorunitId}" id="monitorunitId"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">监控单元:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="monitorunitName" th:field="*{monitorunitName}" class="form-control" type="text"
|
||||
readonly="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否启用:</label>
|
||||
<div class="col-sm-8">
|
||||
|
||||
<select name="enableFlag" id="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>
|
||||
|
||||
<h4 class="form-header h4">设备参数</h4>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus">
|
||||
删除</i></button>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer"/>
|
||||
<th:block th:include="include :: bootstrap-suggest-js"/>
|
||||
<th:block th:include="include :: bootstrap-typeahead-js"/>
|
||||
<th:block th:include="include :: select2-js"/>
|
||||
<script th:src="@{/js/jquery.tmpl.js}"></script>
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "base/monitorUnitInfo";
|
||||
$("#form-sensorInfo-edit").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
$(function () {
|
||||
let data = [[${baseDeviceParams}]];
|
||||
|
||||
// 初始化数据, 可以由后台传过来
|
||||
var options = {
|
||||
data: data,
|
||||
pagination: false,
|
||||
showSearch: false,
|
||||
showRefresh: false,
|
||||
showToggle: false,
|
||||
showColumns: false,
|
||||
sidePagination: "client",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'index',
|
||||
align: 'center',
|
||||
title: "序号",
|
||||
formatter: function (value, row, index) {
|
||||
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
|
||||
var columnId = $.common.sprintf("<input type='hidden' name='deviceParams[%s].id' value='%s'>", index, row.id);
|
||||
return columnIndex + $.table.serialNumber(index) + columnId;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'paramTitle',
|
||||
align: 'center',
|
||||
title: '参数名',
|
||||
formatter: function (value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='deviceParams[%s].paramTitle' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'paramValue',
|
||||
align: 'center',
|
||||
title: '参数值',
|
||||
formatter: function (value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='deviceParams[%s].paramValue' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
|
||||
function addColumn() {
|
||||
var row = {
|
||||
name: "",
|
||||
paramTitle: "",
|
||||
paramValue: "",
|
||||
}
|
||||
sub.addColumn(row);
|
||||
}
|
||||
|
||||
/* 主子表-提交 */
|
||||
function submitHandler(index, layero) {
|
||||
var data = $("#form-device-param").serializeArray();
|
||||
$.operate.save(prefix + "/set", data);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,105 @@
|
||||
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.BaseEntity;
|
||||
|
||||
/**
|
||||
* 设备参数对象 base_device_param
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022-03-24
|
||||
*/
|
||||
public class BaseDeviceParam extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public BaseDeviceParam() {
|
||||
}
|
||||
|
||||
public BaseDeviceParam(String deviceId, Long enableFlag) {
|
||||
this.deviceId = deviceId;
|
||||
this.enableFlag = enableFlag;
|
||||
}
|
||||
|
||||
/** 主键标识 */
|
||||
private Long ObjId;
|
||||
|
||||
/** 设备标识 */
|
||||
@Excel(name = "设备标识")
|
||||
private String deviceId;
|
||||
|
||||
/** 参数标题 */
|
||||
@Excel(name = "参数标题")
|
||||
private String paramTitle;
|
||||
|
||||
/** 参数值 */
|
||||
@Excel(name = "参数值")
|
||||
private String paramValue;
|
||||
|
||||
/** 是否启用 */
|
||||
@Excel(name = "是否启用")
|
||||
private Long enableFlag;
|
||||
|
||||
public void setObjId(Long ObjId)
|
||||
{
|
||||
this.ObjId = ObjId;
|
||||
}
|
||||
|
||||
public Long getObjId()
|
||||
{
|
||||
return ObjId;
|
||||
}
|
||||
public void setDeviceId(String deviceId)
|
||||
{
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public String getDeviceId()
|
||||
{
|
||||
return deviceId;
|
||||
}
|
||||
public void setParamTitle(String paramTitle)
|
||||
{
|
||||
this.paramTitle = paramTitle;
|
||||
}
|
||||
|
||||
public String getParamTitle()
|
||||
{
|
||||
return paramTitle;
|
||||
}
|
||||
public void setParamValue(String paramValue)
|
||||
{
|
||||
this.paramValue = paramValue;
|
||||
}
|
||||
|
||||
public String getParamValue()
|
||||
{
|
||||
return paramValue;
|
||||
}
|
||||
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("deviceId", getDeviceId())
|
||||
.append("paramTitle", getParamTitle())
|
||||
.append("paramValue", getParamValue())
|
||||
.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.BaseDeviceParam;
|
||||
|
||||
/**
|
||||
* 设备参数Mapper接口
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022-03-24
|
||||
*/
|
||||
public interface BaseDeviceParamMapper
|
||||
{
|
||||
/**
|
||||
* 查询设备参数
|
||||
*
|
||||
* @param ObjId 设备参数主键
|
||||
* @return 设备参数
|
||||
*/
|
||||
public BaseDeviceParam selectBaseDeviceParamByObjId(Long ObjId);
|
||||
|
||||
/**
|
||||
* 查询设备参数列表
|
||||
*
|
||||
* @param baseDeviceParam 设备参数
|
||||
* @return 设备参数集合
|
||||
*/
|
||||
public List<BaseDeviceParam> selectBaseDeviceParamList(BaseDeviceParam baseDeviceParam);
|
||||
|
||||
/**
|
||||
* 新增设备参数
|
||||
*
|
||||
* @param baseDeviceParam 设备参数
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseDeviceParam(BaseDeviceParam baseDeviceParam);
|
||||
|
||||
/**
|
||||
* 修改设备参数
|
||||
*
|
||||
* @param baseDeviceParam 设备参数
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseDeviceParam(BaseDeviceParam baseDeviceParam);
|
||||
|
||||
/**
|
||||
* 删除设备参数
|
||||
*
|
||||
* @param ObjId 设备参数主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseDeviceParamByObjId(Long ObjId);
|
||||
|
||||
/**
|
||||
* 批量删除设备参数
|
||||
*
|
||||
* @param ObjIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseDeviceParamByObjIds(String[] ObjIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.BaseDeviceParam;
|
||||
|
||||
/**
|
||||
* 设备参数Service接口
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022-03-24
|
||||
*/
|
||||
public interface IBaseDeviceParamService
|
||||
{
|
||||
/**
|
||||
* 查询设备参数
|
||||
*
|
||||
* @param ObjId 设备参数主键
|
||||
* @return 设备参数
|
||||
*/
|
||||
public BaseDeviceParam selectBaseDeviceParamByObjId(Long ObjId);
|
||||
|
||||
/**
|
||||
* 查询设备参数列表
|
||||
*
|
||||
* @param baseDeviceParam 设备参数
|
||||
* @return 设备参数集合
|
||||
*/
|
||||
public List<BaseDeviceParam> selectBaseDeviceParamList(BaseDeviceParam baseDeviceParam);
|
||||
|
||||
/**
|
||||
* 新增设备参数
|
||||
*
|
||||
* @param baseDeviceParam 设备参数
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseDeviceParam(BaseDeviceParam baseDeviceParam);
|
||||
|
||||
/**
|
||||
* 修改设备参数
|
||||
*
|
||||
* @param baseDeviceParam 设备参数
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseDeviceParam(BaseDeviceParam baseDeviceParam);
|
||||
|
||||
/**
|
||||
* 批量删除设备参数
|
||||
*
|
||||
* @param ObjIds 需要删除的设备参数主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseDeviceParamByObjIds(String ObjIds);
|
||||
|
||||
/**
|
||||
* 删除设备参数信息
|
||||
*
|
||||
* @param ObjId 设备参数主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseDeviceParamByObjId(Long ObjId);
|
||||
}
|
@ -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.BaseDeviceParamMapper;
|
||||
import com.ruoyi.system.domain.BaseDeviceParam;
|
||||
import com.ruoyi.system.service.IBaseDeviceParamService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 设备参数Service业务层处理
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022-03-24
|
||||
*/
|
||||
@Service
|
||||
public class BaseDeviceParamServiceImpl implements IBaseDeviceParamService
|
||||
{
|
||||
@Autowired
|
||||
private BaseDeviceParamMapper baseDeviceParamMapper;
|
||||
|
||||
/**
|
||||
* 查询设备参数
|
||||
*
|
||||
* @param ObjId 设备参数主键
|
||||
* @return 设备参数
|
||||
*/
|
||||
@Override
|
||||
public BaseDeviceParam selectBaseDeviceParamByObjId(Long ObjId)
|
||||
{
|
||||
return baseDeviceParamMapper.selectBaseDeviceParamByObjId(ObjId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备参数列表
|
||||
*
|
||||
* @param baseDeviceParam 设备参数
|
||||
* @return 设备参数
|
||||
*/
|
||||
@Override
|
||||
public List<BaseDeviceParam> selectBaseDeviceParamList(BaseDeviceParam baseDeviceParam)
|
||||
{
|
||||
return baseDeviceParamMapper.selectBaseDeviceParamList(baseDeviceParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备参数
|
||||
*
|
||||
* @param baseDeviceParam 设备参数
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBaseDeviceParam(BaseDeviceParam baseDeviceParam)
|
||||
{
|
||||
baseDeviceParam.setCreateTime(DateUtils.getNowDate());
|
||||
return baseDeviceParamMapper.insertBaseDeviceParam(baseDeviceParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备参数
|
||||
*
|
||||
* @param baseDeviceParam 设备参数
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBaseDeviceParam(BaseDeviceParam baseDeviceParam)
|
||||
{
|
||||
baseDeviceParam.setUpdateTime(DateUtils.getNowDate());
|
||||
return baseDeviceParamMapper.updateBaseDeviceParam(baseDeviceParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除设备参数
|
||||
*
|
||||
* @param ObjIds 需要删除的设备参数主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseDeviceParamByObjIds(String ObjIds)
|
||||
{
|
||||
return baseDeviceParamMapper.deleteBaseDeviceParamByObjIds(Convert.toStrArray(ObjIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备参数信息
|
||||
*
|
||||
* @param ObjId 设备参数主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseDeviceParamByObjId(Long ObjId)
|
||||
{
|
||||
return baseDeviceParamMapper.deleteBaseDeviceParamByObjId(ObjId);
|
||||
}
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
<?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.BaseDeviceParamMapper">
|
||||
|
||||
<resultMap type="BaseDeviceParam" id="BaseDeviceParamResult">
|
||||
<result property="ObjId" column="ObjId" />
|
||||
<result property="deviceId" column="Device_Id" />
|
||||
<result property="paramTitle" column="Param_Title" />
|
||||
<result property="paramValue" column="Param_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="selectBaseDeviceParamVo">
|
||||
select ObjId, Device_Id, Param_Title, Param_Value, Enable_Flag, Create_By, Create_Time, Update_By, Update_Time from base_device_param
|
||||
</sql>
|
||||
|
||||
<select id="selectBaseDeviceParamList" parameterType="BaseDeviceParam" resultMap="BaseDeviceParamResult">
|
||||
<include refid="selectBaseDeviceParamVo"/>
|
||||
<where>
|
||||
<if test="deviceId != null and deviceId != ''"> and Device_Id = #{deviceId}</if>
|
||||
<if test="paramTitle != null and paramTitle != ''"> and Param_Title = #{paramTitle}</if>
|
||||
<if test="enableFlag != null "> and Enable_Flag = #{enableFlag}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBaseDeviceParamByObjId" parameterType="Long" resultMap="BaseDeviceParamResult">
|
||||
<include refid="selectBaseDeviceParamVo"/>
|
||||
where ObjId = #{ObjId}
|
||||
</select>
|
||||
|
||||
<insert id="insertBaseDeviceParam" parameterType="BaseDeviceParam" useGeneratedKeys="true" keyProperty="ObjId">
|
||||
insert into base_device_param
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceId != null">Device_Id,</if>
|
||||
<if test="paramTitle != null">Param_Title,</if>
|
||||
<if test="paramValue != null">Param_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="deviceId != null">#{deviceId},</if>
|
||||
<if test="paramTitle != null">#{paramTitle},</if>
|
||||
<if test="paramValue != null">#{paramValue},</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="updateBaseDeviceParam" parameterType="BaseDeviceParam">
|
||||
update base_device_param
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="deviceId != null">Device_Id = #{deviceId},</if>
|
||||
<if test="paramTitle != null">Param_Title = #{paramTitle},</if>
|
||||
<if test="paramValue != null">Param_Value = #{paramValue},</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="deleteBaseDeviceParamByObjId" parameterType="Long">
|
||||
delete from base_device_param where ObjId = #{ObjId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBaseDeviceParamByObjIds" parameterType="String">
|
||||
delete from base_device_param where ObjId in
|
||||
<foreach item="ObjId" collection="array" open="(" separator="," close=")">
|
||||
#{ObjId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue