add - scada设备信息

master
wenjy 3 years ago
parent 737b4c6a9b
commit b32ada0d24

@ -35,6 +35,8 @@ public class JfpgAnalyzeController {
@Autowired
private IScadaEmsDayElectriclossService scadaEmsDayElectriclossService;
private SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
@GetMapping("/info")
public String Analyze(){
@ -42,13 +44,15 @@ public class JfpgAnalyzeController {
List<ScadaEmsElectricloss> scadaEmsElectriclossList = scadaEmsElectriclossService.selectScadaEmsElectriclossList(new ScadaEmsElectricloss());
Map<Integer,List<BaseJfpgInfo>> jfpgMap = jfpgInfoList.stream().collect(Collectors.groupingBy(BaseJfpgInfo :: getTimeframeCode));
// 尖
List<BaseJfpgInfo> jInfo= jfpgMap.get(0);
// 峰
List<BaseJfpgInfo> fInfo= jfpgMap.get(1);
// 平
List<BaseJfpgInfo> pInfo= jfpgMap.get(2);
// 谷
List<BaseJfpgInfo> gInfo= jfpgMap.get(3);

@ -0,0 +1,163 @@
package com.ruoyi.web.controller.scada;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.web.controller.tool.UUIDTool;
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.BaseScadaDeviceInfo;
import com.ruoyi.system.service.IBaseScadaDeviceInfoService;
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;
/**
* scadaController
*
* @author wenjy
* @date 2021-12-20
*/
@Controller
@RequestMapping("/system/scadaDeviceInfo")
public class BaseScadaDeviceInfoController extends BaseController
{
private String prefix = "system/scadaDeviceInfo";
@Autowired
private IBaseScadaDeviceInfoService baseScadaDeviceInfoService;
@RequiresPermissions("system:scadaDeviceInfo:view")
@GetMapping()
public String scadaDeviceInfo()
{
return prefix + "/scadaDeviceInfo";
}
/**
* scada
*/
@RequiresPermissions("system:scadaDeviceInfo:list")
@PostMapping("/list")
@ResponseBody
public List<BaseScadaDeviceInfo> list(BaseScadaDeviceInfo baseScadaDeviceInfo)
{
List<BaseScadaDeviceInfo> list = baseScadaDeviceInfoService.selectBaseScadaDeviceInfoList(baseScadaDeviceInfo);
return list;
}
/**
* scada
*/
@RequiresPermissions("system:scadaDeviceInfo:export")
@Log(title = "scada设备信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(BaseScadaDeviceInfo baseScadaDeviceInfo)
{
List<BaseScadaDeviceInfo> list = baseScadaDeviceInfoService.selectBaseScadaDeviceInfoList(baseScadaDeviceInfo);
ExcelUtil<BaseScadaDeviceInfo> util = new ExcelUtil<BaseScadaDeviceInfo>(BaseScadaDeviceInfo.class);
return util.exportExcel(list, "scada设备信息数据");
}
/**
* scada
*/
@GetMapping(value = { "/add/{deviceId}", "/add/" })
public String add(@PathVariable(value = "deviceId", required = false) String deviceId, ModelMap mmap)
{
if (StringUtils.isNotNull(deviceId))
{
mmap.put("baseScadaDeviceInfo", baseScadaDeviceInfoService.selectBaseScadaDeviceInfoByDeviceId(deviceId));
}
return prefix + "/add";
}
/**
* scada
*/
@RequiresPermissions("system:scadaDeviceInfo:add")
@Log(title = "scada设备信息", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(BaseScadaDeviceInfo baseScadaDeviceInfo)
{
baseScadaDeviceInfo.setUuid(UUIDTool.generate());
baseScadaDeviceInfo.setCreatedBy(ShiroUtils.getLoginName());
baseScadaDeviceInfo.setCreatedTime(new Date());
return toAjax(baseScadaDeviceInfoService.insertBaseScadaDeviceInfo(baseScadaDeviceInfo));
}
/**
* scada
*/
@GetMapping("/edit/{deviceId}")
public String edit(@PathVariable("deviceId") String deviceId, ModelMap mmap)
{
BaseScadaDeviceInfo baseScadaDeviceInfo = baseScadaDeviceInfoService.selectBaseScadaDeviceInfoByDeviceId(deviceId);
mmap.put("baseScadaDeviceInfo", baseScadaDeviceInfo);
return prefix + "/edit";
}
/**
* scada
*/
@RequiresPermissions("system:scadaDeviceInfo:edit")
@Log(title = "scada设备信息", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(BaseScadaDeviceInfo baseScadaDeviceInfo)
{
baseScadaDeviceInfo.setUpdatedBy(ShiroUtils.getLoginName());
baseScadaDeviceInfo.setUpdatedTime(new Date());
return toAjax(baseScadaDeviceInfoService.updateBaseScadaDeviceInfo(baseScadaDeviceInfo));
}
/**
*
*/
@RequiresPermissions("system:scadaDeviceInfo:remove")
@Log(title = "scada设备信息", businessType = BusinessType.DELETE)
@GetMapping("/remove/{deviceId}")
@ResponseBody
public AjaxResult remove(@PathVariable("deviceId") String deviceId)
{
return toAjax(baseScadaDeviceInfoService.deleteBaseScadaDeviceInfoByDeviceId(deviceId));
}
/**
* scada
*/
@GetMapping(value = { "/selectScadaDeviceInfoTree/{deviceId}", "/selectScadaDeviceInfoTree/" })
public String selectScadaDeviceInfoTree(@PathVariable(value = "deviceId", required = false) String deviceId, ModelMap mmap)
{
if (StringUtils.isNotNull(deviceId))
{
mmap.put("baseScadaDeviceInfo", baseScadaDeviceInfoService.selectBaseScadaDeviceInfoByDeviceId(deviceId));
}
return prefix + "/tree";
}
/**
* scada
*/
@GetMapping("/treeData")
@ResponseBody
public List<Ztree> treeData()
{
List<Ztree> ztrees = baseScadaDeviceInfoService.selectBaseScadaDeviceInfoTree();
return ztrees;
}
}

@ -6,12 +6,12 @@ spring:
druid:
# 主库数据源
master:
# url: jdbc:oracle:thin:@124.70.0.226:1521:ORCL
# username: system
# password: 123456
url: jdbc:oracle:thin:@10.100.71.101:1521:ORCL
username: aucma
password: aucma
url: jdbc:oracle:thin:@124.70.0.226:1521:ORCL
username: system
password: 123456
# url: jdbc:oracle:thin:@10.100.71.101:1521:ORCL
# username: aucma
# password: aucma
# 从库数据源
slave:
# 从数据源开关/默认关闭

@ -140,4 +140,4 @@ swagger:
#可视化看板服务器地址
scadavisual:
address: http://10.100.71.101:8012
address: http://127.0.0.1:8012

@ -0,0 +1,115 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增scada设备信息')" />
<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-scadaDeviceInfo-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="deviceName" 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="deviceParentId" type="hidden" th:value="${baseScadaDeviceInfo?.deviceId}"/>
<input class="form-control" type="text" onclick="selectScadaDeviceInfoTree()" id="treeName" readonly="true" th:value="${baseScadaDeviceInfo?.deviceName}">
<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">设备IP</label>
<div class="col-sm-8">
<input name="deviceIp" 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="createdBy" 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 date">
<input name="createdTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">更新人:</label>
<div class="col-sm-8">
<input name="updatedBy" 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 date">
<input name="updatedTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>-->
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "system/scadaDeviceInfo"
$("#form-scadaDeviceInfo-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-scadaDeviceInfo-add').serialize());
}
}
$("input[name='createdTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='updatedTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
/*scada设备信息-新增-选择父scada设备信息树*/
function selectScadaDeviceInfoTree() {
var options = {
title: 'scada设备信息选择',
width: "380",
url: prefix + "/selectScadaDeviceInfoTree/" + $("#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,116 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改scada设备信息')" />
<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-scadaDeviceInfo-edit" th:object="${baseScadaDeviceInfo}">
<input name="deviceId" th:field="*{uuid}" 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="deviceName" th:field="*{deviceName}" 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="deviceParentId" type="hidden" th:field="*{deviceParentId}" />
<input class="form-control" type="text" onclick="selectScadaDeviceInfoTree()" 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">设备IP</label>
<div class="col-sm-8">
<input name="deviceIp" th:field="*{deviceIp}" 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="createdBy" th:field="*{createdBy}" 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 date">
<input name="createdTime" th:value="${#dates.format(baseScadaDeviceInfo.createdTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">更新人:</label>
<div class="col-sm-8">
<input name="updatedBy" th:field="*{updatedBy}" 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 date">
<input name="updatedTime" th:value="${#dates.format(baseScadaDeviceInfo.updatedTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>-->
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "system/scadaDeviceInfo";
$("#form-scadaDeviceInfo-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-scadaDeviceInfo-edit').serialize());
}
}
$("input[name='createdTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='updatedTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
/*scada设备信息-编辑-选择父scada设备信息树*/
function selectScadaDeviceInfoTree() {
var options = {
title: 'scada设备信息选择',
width: "380",
url: prefix + "/selectScadaDeviceInfoTree/" + $("#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('scada设备信息列表')" />
</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="deviceName"/>
</li>
<li>
<label>父级编号:</label>
<input type="text" name="deviceParentId"/>
</li>
<li>
<label>设备IP</label>
<input type="text" name="deviceIp"/>
</li>
<li class="select-time">
<label>创建时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginCreatedTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endCreatedTime]"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</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="system:scadaDeviceInfo:add">
<i class="fa fa-plus"></i> 新增
</a>
<a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="system:scadaDeviceInfo: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('system:scadaDeviceInfo:add')}]];
var editFlag = [[${@permission.hasPermi('system:scadaDeviceInfo:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:scadaDeviceInfo:remove')}]];
var prefix = ctx + "system/scadaDeviceInfo";
$(function() {
var options = {
code: "deviceId",
parentCode: "deviceParentId",
expandColumn: "2",
uniqueId: "deviceId",
url: prefix + "/list",
createUrl: prefix + "/add/{id}",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove/{id}",
exportUrl: prefix + "/export",
modalName: "scada设备信息",
columns: [{
field: 'selectItem',
radio: true
},
{
field: 'deviceId',
title: '设备编号',
align: 'left'
},
{
field: 'deviceName',
title: '设备名称',
align: 'left',
width: '50%'
},
{
field: 'deviceParentId',
title: '父级编号',
align: 'left',
visible: false
},
{
field: 'deviceIp',
title: '设备IP',
align: 'left'
},
{
field: 'createdBy',
title: '创建人',
align: 'left'
},
{
field: 'createdTime',
title: '创建时间',
align: 'left'
},
{
field: 'updatedBy',
title: '更新人',
align: 'left'
},
{
field: 'updatedTime',
title: '更新时间',
align: 'left'
},
{
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.deviceId + '\')"><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.deviceId + '\')"><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.deviceId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.treeTable.init(options);
});
</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('scada设备信息树选择')" />
<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="${baseScadaDeviceInfo?.deviceId}"/>
<input id="treeName" name="treeName" type="hidden" th:value="${baseScadaDeviceInfo?.deviceName}"/>
<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 + "system/scadaDeviceInfo/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,135 @@
package com.ruoyi.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
/**
* scada base_scada_deviceinfo
*
* @author wenjy
* @date 2021-12-20
*/
public class BaseScadaDeviceInfo extends TreeEntity
{
private static final long serialVersionUID = 1L;
private String uuid;
/** 设备编号 */
@Excel(name = "设备编号")
private String deviceId;
/** 设备名称 */
@Excel(name = "设备名称")
private String deviceName;
/** 父级编号 */
@Excel(name = "父级编号")
private String deviceParentId;
/** 设备IP */
@Excel(name = "设备IP")
private String deviceIp;
/** 创建人 */
@Excel(name = "创建人")
private String createdBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdTime;
/** 更新人 */
@Excel(name = "更新人")
private String updatedBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedTime;
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public void setDeviceId(String deviceId)
{
this.deviceId = deviceId;
}
public String getDeviceId()
{
return deviceId;
}
public void setDeviceName(String deviceName)
{
this.deviceName = deviceName;
}
public String getDeviceName()
{
return deviceName;
}
public void setDeviceIp(String deviceIp)
{
this.deviceIp = deviceIp;
}
public String getDeviceIp()
{
return deviceIp;
}
public void setCreatedBy(String createdBy)
{
this.createdBy = createdBy;
}
public String getCreatedBy()
{
return createdBy;
}
public void setCreatedTime(Date createdTime)
{
this.createdTime = createdTime;
}
public Date getCreatedTime()
{
return createdTime;
}
public void setUpdatedBy(String updatedBy)
{
this.updatedBy = updatedBy;
}
public String getUpdatedBy()
{
return updatedBy;
}
public void setUpdatedTime(Date updatedTime)
{
this.updatedTime = updatedTime;
}
public Date getUpdatedTime()
{
return updatedTime;
}
public String getDeviceParentId() {
return deviceParentId;
}
public void setDeviceParentId(String deviceParentId) {
this.deviceParentId = deviceParentId;
}
}

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.BaseScadaDeviceInfo;
/**
* scadaMapper
*
* @author wenjy
* @date 2021-12-20
*/
public interface BaseScadaDeviceInfoMapper
{
/**
* scada
*
* @param deviceId scada
* @return scada
*/
public BaseScadaDeviceInfo selectBaseScadaDeviceInfoByDeviceId(String deviceId);
/**
* scada
*
* @param baseScadaDeviceInfo scada
* @return scada
*/
public List<BaseScadaDeviceInfo> selectBaseScadaDeviceInfoList(BaseScadaDeviceInfo baseScadaDeviceInfo);
/**
* scada
*
* @param baseScadaDeviceInfo scada
* @return
*/
public int insertBaseScadaDeviceInfo(BaseScadaDeviceInfo baseScadaDeviceInfo);
/**
* scada
*
* @param baseScadaDeviceInfo scada
* @return
*/
public int updateBaseScadaDeviceInfo(BaseScadaDeviceInfo baseScadaDeviceInfo);
/**
* scada
*
* @param deviceId scada
* @return
*/
public int deleteBaseScadaDeviceInfoByDeviceId(String deviceId);
/**
* scada
*
* @param deviceIds
* @return
*/
public int deleteBaseScadaDeviceInfoByDeviceIds(String[] deviceIds);
}

@ -0,0 +1,69 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.BaseScadaDeviceInfo;
import com.ruoyi.common.core.domain.Ztree;
/**
* scadaService
*
* @author wenjy
* @date 2021-12-20
*/
public interface IBaseScadaDeviceInfoService
{
/**
* scada
*
* @param deviceId scada
* @return scada
*/
public BaseScadaDeviceInfo selectBaseScadaDeviceInfoByDeviceId(String deviceId);
/**
* scada
*
* @param baseScadaDeviceInfo scada
* @return scada
*/
public List<BaseScadaDeviceInfo> selectBaseScadaDeviceInfoList(BaseScadaDeviceInfo baseScadaDeviceInfo);
/**
* scada
*
* @param baseScadaDeviceInfo scada
* @return
*/
public int insertBaseScadaDeviceInfo(BaseScadaDeviceInfo baseScadaDeviceInfo);
/**
* scada
*
* @param baseScadaDeviceInfo scada
* @return
*/
public int updateBaseScadaDeviceInfo(BaseScadaDeviceInfo baseScadaDeviceInfo);
/**
* scada
*
* @param deviceIds scada
* @return
*/
public int deleteBaseScadaDeviceInfoByDeviceIds(String deviceIds);
/**
* scada
*
* @param deviceId scada
* @return
*/
public int deleteBaseScadaDeviceInfoByDeviceId(String deviceId);
/**
* scada
*
* @return scada
*/
public List<Ztree> selectBaseScadaDeviceInfoTree();
}

@ -0,0 +1,118 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import java.util.ArrayList;
import com.ruoyi.common.core.domain.Ztree;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BaseScadaDeviceInfoMapper;
import com.ruoyi.system.domain.BaseScadaDeviceInfo;
import com.ruoyi.system.service.IBaseScadaDeviceInfoService;
import com.ruoyi.common.core.text.Convert;
/**
* scadaService
*
* @author wenjy
* @date 2021-12-20
*/
@Service
public class BaseScadaDeviceInfoServiceImpl implements IBaseScadaDeviceInfoService
{
@Autowired
private BaseScadaDeviceInfoMapper baseScadaDeviceInfoMapper;
/**
* scada
*
* @param deviceId scada
* @return scada
*/
@Override
public BaseScadaDeviceInfo selectBaseScadaDeviceInfoByDeviceId(String deviceId)
{
return baseScadaDeviceInfoMapper.selectBaseScadaDeviceInfoByDeviceId(deviceId);
}
/**
* scada
*
* @param baseScadaDeviceInfo scada
* @return scada
*/
@Override
public List<BaseScadaDeviceInfo> selectBaseScadaDeviceInfoList(BaseScadaDeviceInfo baseScadaDeviceInfo)
{
return baseScadaDeviceInfoMapper.selectBaseScadaDeviceInfoList(baseScadaDeviceInfo);
}
/**
* scada
*
* @param baseScadaDeviceInfo scada
* @return
*/
@Override
public int insertBaseScadaDeviceInfo(BaseScadaDeviceInfo baseScadaDeviceInfo)
{
return baseScadaDeviceInfoMapper.insertBaseScadaDeviceInfo(baseScadaDeviceInfo);
}
/**
* scada
*
* @param baseScadaDeviceInfo scada
* @return
*/
@Override
public int updateBaseScadaDeviceInfo(BaseScadaDeviceInfo baseScadaDeviceInfo)
{
return baseScadaDeviceInfoMapper.updateBaseScadaDeviceInfo(baseScadaDeviceInfo);
}
/**
* scada
*
* @param deviceIds scada
* @return
*/
@Override
public int deleteBaseScadaDeviceInfoByDeviceIds(String deviceIds)
{
return baseScadaDeviceInfoMapper.deleteBaseScadaDeviceInfoByDeviceIds(Convert.toStrArray(deviceIds));
}
/**
* scada
*
* @param deviceId scada
* @return
*/
@Override
public int deleteBaseScadaDeviceInfoByDeviceId(String deviceId)
{
return baseScadaDeviceInfoMapper.deleteBaseScadaDeviceInfoByDeviceId(deviceId);
}
/**
* scada
*
* @return scada
*/
@Override
public List<Ztree> selectBaseScadaDeviceInfoTree()
{
List<BaseScadaDeviceInfo> baseScadaDeviceInfoList = baseScadaDeviceInfoMapper.selectBaseScadaDeviceInfoList(new BaseScadaDeviceInfo());
List<Ztree> ztrees = new ArrayList<Ztree>();
for (BaseScadaDeviceInfo baseScadaDeviceInfo : baseScadaDeviceInfoList)
{
Ztree ztree = new Ztree();
ztree.setId(baseScadaDeviceInfo.getDeviceId());
ztree.setpId(baseScadaDeviceInfo.getDeviceParentId());
ztree.setName(baseScadaDeviceInfo.getDeviceName());
ztree.setTitle(baseScadaDeviceInfo.getDeviceName());
ztrees.add(ztree);
}
return ztrees;
}
}

@ -0,0 +1,94 @@
<?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.BaseScadaDeviceInfoMapper">
<resultMap type="BaseScadaDeviceInfo" id="BaseScadaDeviceInfoResult">
<result property="uuid" column="uuid" />
<result property="deviceId" column="device_id" />
<result property="deviceName" column="device_name" />
<result property="deviceParentId" column="parent_id" />
<result property="deviceIp" column="device_ip" />
<result property="createdBy" column="created_by" />
<result property="createdTime" column="created_time" />
<result property="updatedBy" column="updated_by" />
<result property="updatedTime" column="updated_time" />
<result property="parentName" column="parent_name" />
</resultMap>
<sql id="selectBaseScadaDeviceInfoVo">
select uuid,device_id, device_name, parent_id, device_ip, created_by, created_time, updated_by, updated_time from base_scada_deviceinfo
</sql>
<select id="selectBaseScadaDeviceInfoList" parameterType="BaseScadaDeviceInfo" resultMap="BaseScadaDeviceInfoResult">
<include refid="selectBaseScadaDeviceInfoVo"/>
<where>
<if test="deviceId != null and deviceId != ''"> and device_id like concat(concat('%', #{deviceId}), '%')</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat(concat('%', #{deviceName}), '%')</if>
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId}</if>
<if test="deviceIp != null and deviceIp != ''"> and device_ip = #{deviceIp}</if>
<if test="params.beginCreatedTime != null and params.beginCreatedTime != '' and params.endCreatedTime != null and params.endCreatedTime != ''"> and created_time between #{params.beginCreatedTime} and #{params.endCreatedTime}</if>
</where>
order by device_id
</select>
<select id="selectBaseScadaDeviceInfoByDeviceId" parameterType="String" resultMap="BaseScadaDeviceInfoResult">
select t.uuid,t.device_id, t.device_name, t.parent_id, t.device_ip, t.created_by, t.created_time, t.updated_by, t.updated_time, p.device_name as parent_name
from base_scada_deviceinfo t
left join base_scada_deviceinfo p on p.device_id = t.parent_id
where t.device_id = #{deviceId}
</select>
<insert id="insertBaseScadaDeviceInfo" parameterType="BaseScadaDeviceInfo">
insert into base_scada_deviceinfo
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="uuid != null">uuid,</if>
<if test="deviceId != null">device_id,</if>
<if test="deviceName != null">device_name,</if>
<if test="deviceParentId != null">parent_id,</if>
<if test="deviceIp != null">device_ip,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uuid != null">#{uuid},</if>
<if test="deviceId != null">#{deviceId},</if>
<if test="deviceName != null">#{deviceName},</if>
<if test="deviceParentId != null">#{deviceParentId},</if>
<if test="deviceIp != null">#{deviceIp},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
</trim>
</insert>
<update id="updateBaseScadaDeviceInfo" parameterType="BaseScadaDeviceInfo">
update base_scada_deviceinfo
<trim prefix="SET" suffixOverrides=",">
<if test="deviceName != null">device_name = #{deviceName},</if>
<if test="deviceId != null">device_id = #{deviceId},</if>
<if test="deviceParentId != null">parent_id = #{deviceParentId},</if>
<if test="deviceIp != null">device_ip = #{deviceIp},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
</trim>
where uuid = #{uuid}
</update>
<delete id="deleteBaseScadaDeviceInfoByDeviceId" parameterType="String">
delete from base_scada_deviceinfo where device_id = #{deviceId}
</delete>
<delete id="deleteBaseScadaDeviceInfoByDeviceIds" parameterType="String">
delete from base_scada_deviceinfo where device_id in
<foreach item="deviceId" collection="array" open="(" separator="," close=")">
#{deviceId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save