add - 参数配置页面,change - 传感器实时数据展示
parent
6eabc5a1d7
commit
4bb93d081d
@ -0,0 +1,114 @@
|
||||
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.SysParamConfig;
|
||||
import com.ruoyi.system.service.ISysParamConfigService;
|
||||
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-16
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/base/sysParamConfig")
|
||||
public class SysParamConfigController extends BaseController {
|
||||
private String prefix = "base/sysParamConfig";
|
||||
|
||||
@Autowired private ISysParamConfigService sysParamConfigService;
|
||||
|
||||
@RequiresPermissions("base:sysParamConfig:view")
|
||||
@GetMapping()
|
||||
public String sysParamConfig() {
|
||||
return prefix + "/sysParamConfig";
|
||||
}
|
||||
|
||||
/** 查询传感器参数配置列表 */
|
||||
@RequiresPermissions("base:sysParamConfig:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysParamConfig sysParamConfig) {
|
||||
startPage();
|
||||
List<SysParamConfig> list = sysParamConfigService.selectSysParamConfigList(sysParamConfig);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/getParameter")
|
||||
@ResponseBody
|
||||
public String getParameter(String sensorTypeId) {
|
||||
SysParamConfig sysParamConfig = new SysParamConfig();
|
||||
sysParamConfig.setParamType(sensorTypeId);
|
||||
List<SysParamConfig> sysParamConfigs =
|
||||
sysParamConfigService.selectSysParamConfigList(sysParamConfig);
|
||||
return JSONArray.toJSONString(sysParamConfigs);
|
||||
}
|
||||
|
||||
/** 导出传感器参数配置列表 */
|
||||
@RequiresPermissions("base:sysParamConfig:export")
|
||||
@Log(title = "传感器参数配置", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysParamConfig sysParamConfig) {
|
||||
List<SysParamConfig> list = sysParamConfigService.selectSysParamConfigList(sysParamConfig);
|
||||
ExcelUtil<SysParamConfig> util = new ExcelUtil<SysParamConfig>(SysParamConfig.class);
|
||||
return util.exportExcel(list, "传感器参数配置数据");
|
||||
}
|
||||
|
||||
/** 新增传感器参数配置 */
|
||||
@GetMapping("/add")
|
||||
public String add() {
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/** 新增保存传感器参数配置 */
|
||||
@RequiresPermissions("base:sysParamConfig:add")
|
||||
@Log(title = "传感器参数配置", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(SysParamConfig sysParamConfig) {
|
||||
return toAjax(sysParamConfigService.insertSysParamConfig(sysParamConfig));
|
||||
}
|
||||
|
||||
/** 修改传感器参数配置 */
|
||||
@GetMapping("/edit/{ObjId}")
|
||||
public String edit(@PathVariable("ObjId") Long ObjId, ModelMap mmap) {
|
||||
SysParamConfig sysParamConfig = sysParamConfigService.selectSysParamConfigByObjId(ObjId);
|
||||
mmap.put("sysParamConfig", sysParamConfig);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/** 修改保存传感器参数配置 */
|
||||
@RequiresPermissions("base:sysParamConfig:edit")
|
||||
@Log(title = "传感器参数配置", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(SysParamConfig sysParamConfig) {
|
||||
return toAjax(sysParamConfigService.updateSysParamConfig(sysParamConfig));
|
||||
}
|
||||
|
||||
/** 删除传感器参数配置 */
|
||||
@RequiresPermissions("base:sysParamConfig:remove")
|
||||
@Log(title = "传感器参数配置", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids) {
|
||||
return toAjax(sysParamConfigService.deleteSysParamConfigByObjIds(ids));
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,80 +1,116 @@
|
||||
const sensorInfoList = function(sensorTypeId) {
|
||||
$('#table').bootstrapTable('destroy');
|
||||
$('#table').bootstrapTable({
|
||||
url: '/iot/sensorSummary/getSensorInfo?sensorTypeId='+sensorTypeId, // 表格数据来源
|
||||
pageNumber: 1,
|
||||
pagination: true,
|
||||
sidePagination: 'client',
|
||||
pageSize: 10,
|
||||
pageList: [5, 10, 15, 20, 25, 50],
|
||||
showRefresh: false,
|
||||
columns: [{
|
||||
field: 'id',
|
||||
title: '序号',
|
||||
align: 'center',
|
||||
const sensorInfoList = function (sensorTypeId) {
|
||||
|
||||
}, {
|
||||
field: 'edgeId',
|
||||
title: '边设备ID',
|
||||
align: 'center',
|
||||
}, {
|
||||
field: 'sensorId',
|
||||
title: '传感器ID',
|
||||
align: 'center',
|
||||
}, {
|
||||
field: 'sensorData',
|
||||
title: '传感器数据',
|
||||
align: 'center',
|
||||
}, {
|
||||
field: 'rssi',
|
||||
title: 'RSSI',
|
||||
align: 'center',
|
||||
}, {
|
||||
field: 'voltage',
|
||||
title: '电压',
|
||||
align: 'center',
|
||||
}, {
|
||||
field: 'collectTime',
|
||||
title: '时间',
|
||||
align: 'center',
|
||||
}, {
|
||||
field: 'monitorLocation',
|
||||
title: '监测位置',
|
||||
align: 'center',
|
||||
}]
|
||||
let formData = new FormData();
|
||||
formData.append("sensorTypeId", sensorTypeId);
|
||||
|
||||
let sensorTypeArray = [];
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/base/sysParamConfig/getParameter",
|
||||
data: formData,
|
||||
contentType: "application/json;charset=utf-8",
|
||||
dataType: "json",
|
||||
json: 'callback',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (json) {
|
||||
sensorTypeArray = json;
|
||||
},
|
||||
error: function () {
|
||||
alert("错误");
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/iot/sensorSummary/getSensorInfo",
|
||||
data: formData,
|
||||
contentType: "application/json;charset=utf-8",
|
||||
dataType: "json",
|
||||
json: 'callback',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (json) {
|
||||
const columnsArray = [];
|
||||
columnsArray.push({field: "id", title: "序号", width: 60, colspan: 1, rowspan: 1, align: "center"});
|
||||
columnsArray.push({field: "edgeId", title: "边设备ID", width: 145, colspan: 1, rowspan: 1, align: "center"});
|
||||
columnsArray.push({field: "sensorId", title: "传感器ID", width: 145, colspan: 1, rowspan: 1, align: "center"});
|
||||
columnsArray.push({
|
||||
field: "sensorLocation",
|
||||
title: "监测位置",
|
||||
width: 145,
|
||||
colspan: 1,
|
||||
rowspan: 1,
|
||||
align: "center"
|
||||
});
|
||||
|
||||
if (json.length > 0) {
|
||||
for (let i = 0; i < (Object.keys(json[0])).length; i++) {//Object.keys(obj) 获取key名称
|
||||
let property = (Object.keys(json[0]))[i];
|
||||
if (property != "id" && property != "edgeId" && property != "sensorId" && property != 'sensorLocation' && property != 'datatype') {
|
||||
columnsArray.push({
|
||||
field: property,
|
||||
title: sensorTypeArray.find(array => array.paramTitle === property).paramText,
|
||||
width: property === "imgstr" ? 500 : 160,
|
||||
align: "center",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#table').bootstrapTable('destroy');
|
||||
$('#table').bootstrapTable({
|
||||
data: json,
|
||||
pageNumber: 1,
|
||||
pagination: true,
|
||||
sidePagination: 'client',
|
||||
pageSize: 10,
|
||||
pageList: [5, 10, 15, 20, 25, 50],
|
||||
showRefresh: false,
|
||||
columns: columnsArray
|
||||
});
|
||||
|
||||
columnsArray.push();
|
||||
|
||||
sensorTypeArray.push();
|
||||
},
|
||||
error: function () {
|
||||
alert("错误");
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const onSearchByMonitorLocation = function (obj) {
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
var storeId = document.getElementById('table');
|
||||
var rowsLength = storeId.rows.length;
|
||||
var key = obj.value;
|
||||
var searchCol = 7;
|
||||
for(var i=1;i<rowsLength;i++){
|
||||
var searchCol = 3;
|
||||
for (var i = 1; i < rowsLength; i++) {
|
||||
var searchText = storeId.rows[i].cells[searchCol].innerHTML;
|
||||
if(searchText.match(key)){
|
||||
storeId.rows[i].style.display='';
|
||||
}else{
|
||||
storeId.rows[i].style.display='none';
|
||||
if (searchText.match(key)) {
|
||||
storeId.rows[i].style.display = '';
|
||||
} else {
|
||||
storeId.rows[i].style.display = 'none';
|
||||
}
|
||||
}
|
||||
},500);
|
||||
}, 500);
|
||||
}
|
||||
|
||||
const onSearchBySensorId = function (obj) {
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
var storeId = document.getElementById('table');
|
||||
var rowsLength = storeId.rows.length;
|
||||
var key = obj.value;
|
||||
var searchCol = 2;
|
||||
for(var i=1;i<rowsLength;i++){
|
||||
for (var i = 1; i < rowsLength; i++) {
|
||||
var searchText = storeId.rows[i].cells[searchCol].innerHTML;
|
||||
if(searchText.match(key)){
|
||||
storeId.rows[i].style.display='';
|
||||
}else{
|
||||
storeId.rows[i].style.display='none';
|
||||
if (searchText.match(key)) {
|
||||
storeId.rows[i].style.display = '';
|
||||
} else {
|
||||
storeId.rows[i].style.display = 'none';
|
||||
}
|
||||
}
|
||||
},500);
|
||||
}, 500);
|
||||
}
|
@ -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-sysParamConfig-add">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">参数类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="paramType" 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="paramText" 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/sysParamConfig"
|
||||
$("#form-sysParamConfig-add").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-sysParamConfig-add').serialize());
|
||||
}
|
||||
}
|
||||
</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-sysParamConfig-edit" th:object="${sysParamConfig}">
|
||||
<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="paramType" th:field="*{paramType}" 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="paramText" th:field="*{paramText}" 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/sysParamConfig";
|
||||
$("#form-sysParamConfig-edit").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-sysParamConfig-edit').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="paramType"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>参数标题:</label>
|
||||
<input type="text" name="paramTitle"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>参数说明:</label>
|
||||
<input type="text" name="paramText"/>
|
||||
</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:sysParamConfig:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="base:sysParamConfig:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="base:sysParamConfig:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="base:sysParamConfig: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:sysParamConfig:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('base:sysParamConfig:remove')}]];
|
||||
var enableFlagDatas = [[${@dict.getType('enable_flag')}]];
|
||||
var prefix = ctx + "base/sysParamConfig";
|
||||
|
||||
$(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: 'paramType',
|
||||
title: '参数类型'
|
||||
},
|
||||
{
|
||||
field: 'paramTitle',
|
||||
title: '参数标题'
|
||||
},
|
||||
{
|
||||
field: 'paramText',
|
||||
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,58 @@
|
||||
package com.ruoyi.common.json;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* json通用处理
|
||||
* @author WenJY
|
||||
* @date 2022年03月17日 10:07
|
||||
*/
|
||||
public class JsonUtils {
|
||||
|
||||
/**
|
||||
* jsonObject 转为 Map
|
||||
* @author WenJY
|
||||
* @date 2022/3/17 10:09
|
||||
* @param datavalue
|
||||
* @return java.util.Map<java.lang.String,java.lang.Object>
|
||||
*/
|
||||
public static Map<String, Object> JSONObjectToMap(com.alibaba.fastjson.JSONObject datavalue) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
for (Object obj : datavalue.keySet()) {
|
||||
if (datavalue.get(obj) instanceof JSONArray) {
|
||||
List<Map<String, Object>> projectSiteList =
|
||||
(List<Map<String, Object>>) JSONArray.parse(datavalue.get(obj).toString());
|
||||
for (int i = 0; i < projectSiteList.size(); i++) {
|
||||
Map<String, Object> map1 = projectSiteList.get(i);
|
||||
for (String item : map1.keySet()) {
|
||||
if (map1.get(item) instanceof JSONArray) {
|
||||
|
||||
JSONArray jsonArray = JSONArray.parseArray(map1.get(item).toString());
|
||||
for (Object jsonObject : jsonArray) {
|
||||
Map<String, Object> children =
|
||||
JSONObjectToMap(JSONObject.parseObject(jsonObject.toString()));
|
||||
children
|
||||
.keySet()
|
||||
.forEach(
|
||||
x -> {
|
||||
result.put(item + x, children.get(x));
|
||||
});
|
||||
}
|
||||
continue;
|
||||
}
|
||||
result.put(obj + item, map1.get(item));
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
result.put(obj.toString(), datavalue.get(obj));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 传感器参数配置对象 sys_param_config
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022-03-16
|
||||
*/
|
||||
public class SysParamConfig extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键标识 */
|
||||
private Long ObjId;
|
||||
|
||||
/** 参数类型 */
|
||||
@Excel(name = "参数类型")
|
||||
private String paramType;
|
||||
|
||||
/** 参数标题 */
|
||||
@Excel(name = "参数标题")
|
||||
private String paramTitle;
|
||||
|
||||
/** 参数说明 */
|
||||
@Excel(name = "参数说明")
|
||||
private String paramText;
|
||||
|
||||
/** 是否启用 */
|
||||
@Excel(name = "是否启用")
|
||||
private Long enableFlag;
|
||||
|
||||
public void setObjId(Long ObjId)
|
||||
{
|
||||
this.ObjId = ObjId;
|
||||
}
|
||||
|
||||
public Long getObjId()
|
||||
{
|
||||
return ObjId;
|
||||
}
|
||||
public void setParamType(String paramType)
|
||||
{
|
||||
this.paramType = paramType;
|
||||
}
|
||||
|
||||
public String getParamType()
|
||||
{
|
||||
return paramType;
|
||||
}
|
||||
public void setParamTitle(String paramTitle)
|
||||
{
|
||||
this.paramTitle = paramTitle;
|
||||
}
|
||||
|
||||
public String getParamTitle()
|
||||
{
|
||||
return paramTitle;
|
||||
}
|
||||
public void setParamText(String paramText)
|
||||
{
|
||||
this.paramText = paramText;
|
||||
}
|
||||
|
||||
public String getParamText()
|
||||
{
|
||||
return paramText;
|
||||
}
|
||||
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("paramType", getParamType())
|
||||
.append("paramTitle", getParamTitle())
|
||||
.append("paramText", getParamText())
|
||||
.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.SysParamConfig;
|
||||
|
||||
/**
|
||||
* 传感器参数配置Mapper接口
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022-03-16
|
||||
*/
|
||||
public interface SysParamConfigMapper
|
||||
{
|
||||
/**
|
||||
* 查询传感器参数配置
|
||||
*
|
||||
* @param ObjId 传感器参数配置主键
|
||||
* @return 传感器参数配置
|
||||
*/
|
||||
public SysParamConfig selectSysParamConfigByObjId(Long ObjId);
|
||||
|
||||
/**
|
||||
* 查询传感器参数配置列表
|
||||
*
|
||||
* @param sysParamConfig 传感器参数配置
|
||||
* @return 传感器参数配置集合
|
||||
*/
|
||||
public List<SysParamConfig> selectSysParamConfigList(SysParamConfig sysParamConfig);
|
||||
|
||||
/**
|
||||
* 新增传感器参数配置
|
||||
*
|
||||
* @param sysParamConfig 传感器参数配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysParamConfig(SysParamConfig sysParamConfig);
|
||||
|
||||
/**
|
||||
* 修改传感器参数配置
|
||||
*
|
||||
* @param sysParamConfig 传感器参数配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysParamConfig(SysParamConfig sysParamConfig);
|
||||
|
||||
/**
|
||||
* 删除传感器参数配置
|
||||
*
|
||||
* @param ObjId 传感器参数配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysParamConfigByObjId(Long ObjId);
|
||||
|
||||
/**
|
||||
* 批量删除传感器参数配置
|
||||
*
|
||||
* @param ObjIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysParamConfigByObjIds(String[] ObjIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.SysParamConfig;
|
||||
|
||||
/**
|
||||
* 传感器参数配置Service接口
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022-03-16
|
||||
*/
|
||||
public interface ISysParamConfigService
|
||||
{
|
||||
/**
|
||||
* 查询传感器参数配置
|
||||
*
|
||||
* @param ObjId 传感器参数配置主键
|
||||
* @return 传感器参数配置
|
||||
*/
|
||||
public SysParamConfig selectSysParamConfigByObjId(Long ObjId);
|
||||
|
||||
/**
|
||||
* 查询传感器参数配置列表
|
||||
*
|
||||
* @param sysParamConfig 传感器参数配置
|
||||
* @return 传感器参数配置集合
|
||||
*/
|
||||
public List<SysParamConfig> selectSysParamConfigList(SysParamConfig sysParamConfig);
|
||||
|
||||
/**
|
||||
* 新增传感器参数配置
|
||||
*
|
||||
* @param sysParamConfig 传感器参数配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysParamConfig(SysParamConfig sysParamConfig);
|
||||
|
||||
/**
|
||||
* 修改传感器参数配置
|
||||
*
|
||||
* @param sysParamConfig 传感器参数配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysParamConfig(SysParamConfig sysParamConfig);
|
||||
|
||||
/**
|
||||
* 批量删除传感器参数配置
|
||||
*
|
||||
* @param ObjIds 需要删除的传感器参数配置主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysParamConfigByObjIds(String ObjIds);
|
||||
|
||||
/**
|
||||
* 删除传感器参数配置信息
|
||||
*
|
||||
* @param ObjId 传感器参数配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysParamConfigByObjId(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.SysParamConfigMapper;
|
||||
import com.ruoyi.system.domain.SysParamConfig;
|
||||
import com.ruoyi.system.service.ISysParamConfigService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 传感器参数配置Service业务层处理
|
||||
*
|
||||
* @author WenJY
|
||||
* @date 2022-03-16
|
||||
*/
|
||||
@Service
|
||||
public class SysParamConfigServiceImpl implements ISysParamConfigService
|
||||
{
|
||||
@Autowired
|
||||
private SysParamConfigMapper sysParamConfigMapper;
|
||||
|
||||
/**
|
||||
* 查询传感器参数配置
|
||||
*
|
||||
* @param ObjId 传感器参数配置主键
|
||||
* @return 传感器参数配置
|
||||
*/
|
||||
@Override
|
||||
public SysParamConfig selectSysParamConfigByObjId(Long ObjId)
|
||||
{
|
||||
return sysParamConfigMapper.selectSysParamConfigByObjId(ObjId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询传感器参数配置列表
|
||||
*
|
||||
* @param sysParamConfig 传感器参数配置
|
||||
* @return 传感器参数配置
|
||||
*/
|
||||
@Override
|
||||
public List<SysParamConfig> selectSysParamConfigList(SysParamConfig sysParamConfig)
|
||||
{
|
||||
return sysParamConfigMapper.selectSysParamConfigList(sysParamConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增传感器参数配置
|
||||
*
|
||||
* @param sysParamConfig 传感器参数配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysParamConfig(SysParamConfig sysParamConfig)
|
||||
{
|
||||
sysParamConfig.setCreateTime(DateUtils.getNowDate());
|
||||
return sysParamConfigMapper.insertSysParamConfig(sysParamConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改传感器参数配置
|
||||
*
|
||||
* @param sysParamConfig 传感器参数配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysParamConfig(SysParamConfig sysParamConfig)
|
||||
{
|
||||
sysParamConfig.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysParamConfigMapper.updateSysParamConfig(sysParamConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除传感器参数配置
|
||||
*
|
||||
* @param ObjIds 需要删除的传感器参数配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysParamConfigByObjIds(String ObjIds)
|
||||
{
|
||||
return sysParamConfigMapper.deleteSysParamConfigByObjIds(Convert.toStrArray(ObjIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除传感器参数配置信息
|
||||
*
|
||||
* @param ObjId 传感器参数配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysParamConfigByObjId(Long ObjId)
|
||||
{
|
||||
return sysParamConfigMapper.deleteSysParamConfigByObjId(ObjId);
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
<?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.SysParamConfigMapper">
|
||||
|
||||
<resultMap type="SysParamConfig" id="SysParamConfigResult">
|
||||
<result property="ObjId" column="ObjId" />
|
||||
<result property="paramType" column="Param_Type" />
|
||||
<result property="paramTitle" column="Param_Title" />
|
||||
<result property="paramText" column="Param_Text" />
|
||||
<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="selectSysParamConfigVo">
|
||||
select ObjId, Param_Type, Param_Title, Param_Text, Enable_Flag, Create_By, Create_Time, Update_By, Update_Time from sys_param_config
|
||||
</sql>
|
||||
|
||||
<select id="selectSysParamConfigList" parameterType="SysParamConfig" resultMap="SysParamConfigResult">
|
||||
<include refid="selectSysParamConfigVo"/>
|
||||
<where>
|
||||
<if test="paramType != null and paramType != ''"> and Param_Type = #{paramType}</if>
|
||||
<if test="paramTitle != null and paramTitle != ''"> and Param_Title = #{paramTitle}</if>
|
||||
<if test="paramText != null and paramText != ''"> and Param_Text = #{paramText}</if>
|
||||
<if test="enableFlag != null "> and Enable_Flag = #{enableFlag}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysParamConfigByObjId" parameterType="Long" resultMap="SysParamConfigResult">
|
||||
<include refid="selectSysParamConfigVo"/>
|
||||
where ObjId = #{ObjId}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysParamConfig" parameterType="SysParamConfig" useGeneratedKeys="true" keyProperty="ObjId">
|
||||
insert into sys_param_config
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="paramType != null">Param_Type,</if>
|
||||
<if test="paramTitle != null">Param_Title,</if>
|
||||
<if test="paramText != null">Param_Text,</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="paramType != null">#{paramType},</if>
|
||||
<if test="paramTitle != null">#{paramTitle},</if>
|
||||
<if test="paramText != null">#{paramText},</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="updateSysParamConfig" parameterType="SysParamConfig">
|
||||
update sys_param_config
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="paramType != null">Param_Type = #{paramType},</if>
|
||||
<if test="paramTitle != null">Param_Title = #{paramTitle},</if>
|
||||
<if test="paramText != null">Param_Text = #{paramText},</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="deleteSysParamConfigByObjId" parameterType="Long">
|
||||
delete from sys_param_config where ObjId = #{ObjId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysParamConfigByObjIds" parameterType="String">
|
||||
delete from sys_param_config where ObjId in
|
||||
<foreach item="ObjId" collection="array" open="(" separator="," close=")">
|
||||
#{ObjId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue