change - 告警单元优化处理

main
wenjy 3 years ago
parent ed4c787759
commit 53289c0e18

@ -5,6 +5,7 @@ import java.util.List;
import java.util.UUID;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.domain.dto.BaseAlarmModuleDto;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -54,7 +55,7 @@ public class BaseAlarmModuleController extends BaseController
public TableDataInfo list(BaseAlarmModule baseAlarmModule)
{
startPage();
List<BaseAlarmModule> list = baseAlarmModuleService.selectBaseAlarmModuleList(baseAlarmModule);
List<BaseAlarmModuleDto> list = baseAlarmModuleService.selectBaseAlarmModuleList(baseAlarmModule);
return getDataTable(list);
}
@ -67,8 +68,8 @@ public class BaseAlarmModuleController extends BaseController
@ResponseBody
public AjaxResult export(BaseAlarmModule baseAlarmModule)
{
List<BaseAlarmModule> list = baseAlarmModuleService.selectBaseAlarmModuleList(baseAlarmModule);
ExcelUtil<BaseAlarmModule> util = new ExcelUtil<BaseAlarmModule>(BaseAlarmModule.class);
List<BaseAlarmModuleDto> list = baseAlarmModuleService.selectBaseAlarmModuleList(baseAlarmModule);
ExcelUtil<BaseAlarmModuleDto> util = new ExcelUtil<BaseAlarmModuleDto>(BaseAlarmModuleDto.class);
return util.exportExcel(list, "报警信息单元数据");
}

@ -7,17 +7,36 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-alarmModule-add">
<input name="monitorunitId" type="hidden" id="treeId"/>
<div class="form-group">
<label class="col-sm-3 control-label">告警单元:</label>
<div class="col-sm-8">
<input name="alarmmoduleText" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<!--<div class="form-group">
<label class="col-sm-3 control-label">监控单元:</label>
<div class="col-sm-8">
<input name="monitorunitId" 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 class="form-control" type="text" name="treeName" onclick="selectMonitorTree()" id="treeName">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">报警类型:</label>
<div class="col-sm-8">
<select name="alarmTypeId" class="form-control m-b" th:with="type=${@alarmTypeService.getParamType()}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.alarmtypeName}" th:value="${dict.alarmtypeId}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否启用:</label>
@ -55,6 +74,38 @@
minView: "month",
autoclose: true
});
/* 选择监控单元树 */
function selectMonitorTree() {
var deptId = $.common.isEmpty($("#treeId").val()) ? "" : $("#treeId").val();
var url = ctx + "base/monitorUnitInfo/selectMonitorUnitInfoTree/" + deptId;
var options = {
title: '选择部门',
width: "380",
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero){
var tree = layero.find("iframe")[0].contentWindow.$._tree;
var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
$.modal.close(index);
}
$(()=>{
var cp_keynum = "alarmModule_MonitorUnit";
var str = localStorage.getItem(cp_keynum);
var num = JSON.parse(str);
if(num != null) {
$("#treeId").val(num.cp_num_value.substring(0, num.cp_num_value.indexOf('/')));
$("#treeName").val(num.cp_num_value.substring(num.cp_num_value.indexOf('/')+1,num.cp_num_value.length ));
}
})
</script>
</body>
</html>

@ -2,8 +2,34 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('报警信息单元列表')" />
<th:block th:include="include :: layout-latest-css"/>
<th:block th:include="include :: ztree-css"/>
</head>
<body class="gray-bg">
<div class="ui-layout-west">
<div class="box box-main">
<div class="box-header">
<div class="box-title">
<i class="fa icon-grid"></i> 监控单元
</div>
<div class="box-tools pull-right">
<a type="button" class="btn btn-box-tool" href="#" onclick="monitorUnitInfo()" title="监控单元"><i
class="fa fa-edit"></i></a>
<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i
class="fa fa-chevron-up"></i></button>
<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i
class="fa fa-chevron-down"></i></button>
<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新"><i class="fa fa-refresh"></i>
</button>
</div>
</div>
<div class="ui-layout-content">
<div id="tree" class="ztree"></div>
</div>
</div>
</div>
<div class="ui-layout-center">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
@ -53,14 +79,41 @@
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('base:alarmModule:edit')}]];
var removeFlag = [[${@permission.hasPermi('base:alarmModule:remove')}]];
var enableFlagDatas = [[${@dict.getType('enable_flag')}]];
var prefix = ctx + "base/alarmModule";
$(function() {
$(() => {
if (typeof (Storage) == 'undefined') {
alert('对不起,您的浏览器不支持 web 存储。')
}
});
$(function () {
var panehHidden = false;
if ($(this).width() < 769) {
panehHidden = true;
}
$('body').layout({initClosed: panehHidden, west__size: 185});
// 回到顶部绑定
if ($.fn.toTop !== undefined) {
var opt = {
win: $('.ui-layout-center'),
doc: $('.ui-layout-center')
};
$('#scroll-up').toTop(opt);
}
queryAlarmModuleList();
queryMonitorTree();
});
function queryAlarmModuleList() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
@ -80,14 +133,14 @@
field: 'alarmmoduleText',
title: '告警单元'
},
{
field: 'alarmTypeId',
title: '报警类型'
},
{
field: 'monitorunitId',
field: 'monitorunitName',
title: '监控单元'
},
{
field: 'alarmTypeName',
title: '报警类型'
},
{
field: 'enableFlag',
title: '是否启用',
@ -123,7 +176,49 @@
}]
};
$.table.init(options);
}
function queryMonitorTree() {
let url = ctx + "base/monitorUnitInfo/treeData";
let options = {
url: url,
expandLevel: 2,
onClick: zOnClick
};
$.tree.init(options);
function zOnClick(event, treeId, treeNode) {
$("#monitorunitId").val(treeNode.id);
$.table.search();
var num = new Object;
num.cp_keynum = "alarmModule_MonitorUnit";
num.cp_num_value = treeNode.id + "/" + treeNode.name;
var str = JSON.stringify(num); // 将对象转换为字符串
localStorage.setItem(num.cp_keynum, str);
}
}
$('#btnExpand').click(function () {
$._tree.expandAll(true);
$(this).hide();
$('#btnCollapse').show();
});
$('#btnCollapse').click(function () {
$._tree.expandAll(false);
$(this).hide();
$('#btnExpand').show();
});
$('#btnRefresh').click(function () {
queryMonitorTree();
});
function monitorUnitInfo() {
var url = ctx + "base/monitorUnitInfo";
$.modal.openTab("监控单元", url);
}
</script>
</body>
</html>

@ -9,6 +9,7 @@
<form class="form-horizontal m" id="form-alarmModule-edit" th:object="${baseAlarmModule}">
<input name="objId" th:field="*{objId}" type="hidden">
<input name="alarmmoduleId" th:field="*{alarmmoduleId}" type="hidden">
<input name="monitorunitId" type="hidden" th:field="*{monitorunitId}" id="treeId"/>
<div class="form-group">
<label class="col-sm-3 control-label">告警单元:</label>
@ -16,10 +17,22 @@
<input name="alarmmoduleText" th:field="*{alarmmoduleText}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<div class="form-group">
<label class="col-sm-3 control-label">监控单元:</label>
<div class="col-sm-8">
<input name="monitorunitId" th:field="*{monitorunitId}" class="form-control" type="text">
<div class="input-group">
<input class="form-control" type="text" name="treeName" onclick="selectMonitorTree()" id="treeName" th:field="*{monitorunitName}">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">报警类型:</label>
<div class="col-sm-8">
<select name="alarmTypeId" class="form-control m-b" th:with="type=${@alarmTypeService.getParamType()}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.alarmtypeName}" th:value="${dict.alarmtypeId}" th:field="*{alarmTypeId}"></option>
</select>
</div>
</div>
<div class="form-group">
@ -57,6 +70,27 @@
minView: "month",
autoclose: true
});
/* 选择监控单元树 */
function selectMonitorTree() {
var deptId = $.common.isEmpty($("#treeId").val()) ? "" : $("#treeId").val();
var url = ctx + "base/monitorUnitInfo/selectMonitorUnitInfoTree/" + deptId;
var options = {
title: '选择部门',
width: "380",
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero){
var tree = layero.find("iframe")[0].contentWindow.$._tree;
var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
$.modal.close(index);
}
</script>
</body>
</html>

@ -18,7 +18,7 @@ public class BaseAlarmModule extends BaseEntity
private static final long serialVersionUID = 1L;
/** 主键标识 */
private String objId;
private Long objId;
/** 单元编号 */
@Excel(name = "单元编号")
@ -57,16 +57,15 @@ public class BaseAlarmModule extends BaseEntity
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedTime;
public void setObjId(String objId)
{
this.objId = objId;
public Long getObjId() {
return objId;
}
public String getObjId()
{
return objId;
public void setObjId(Long objId) {
this.objId = objId;
}
public void setAlarmmoduleId(String alarmmoduleId)
public void setAlarmmoduleId(String alarmmoduleId)
{
this.alarmmoduleId = alarmmoduleId;
}

@ -0,0 +1,16 @@
package com.ruoyi.system.domain.dto;
import com.ruoyi.system.domain.BaseAlarmModule;
import lombok.Data;
/**
* @author WenJY
* @date 20220326 17:19
*/
@Data
public class BaseAlarmModuleDto extends BaseAlarmModule {
private String monitorunitName;
private String alarmTypeName;
}

@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.BaseAlarmModule;
import com.ruoyi.system.domain.dto.BaseAlarmModuleDto;
/**
* Mapper
@ -25,7 +26,7 @@ public interface BaseAlarmModuleMapper
* @param baseAlarmModule
* @return
*/
public List<BaseAlarmModule> selectBaseAlarmModuleList(BaseAlarmModule baseAlarmModule);
public List<BaseAlarmModuleDto> selectBaseAlarmModuleList(BaseAlarmModule baseAlarmModule);
/**
*

@ -2,6 +2,7 @@ package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.BaseAlarmModule;
import com.ruoyi.system.domain.dto.BaseAlarmModuleDto;
/**
* Service
@ -25,7 +26,7 @@ public interface IBaseAlarmModuleService
* @param baseAlarmModule
* @return
*/
public List<BaseAlarmModule> selectBaseAlarmModuleList(BaseAlarmModule baseAlarmModule);
public List<BaseAlarmModuleDto> selectBaseAlarmModuleList(BaseAlarmModule baseAlarmModule);
/**
*

@ -1,6 +1,8 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.system.domain.dto.BaseAlarmModuleDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BaseAlarmModuleMapper;
@ -39,7 +41,7 @@ public class BaseAlarmModuleServiceImpl implements IBaseAlarmModuleService
* @return
*/
@Override
public List<BaseAlarmModule> selectBaseAlarmModuleList(BaseAlarmModule baseAlarmModule)
public List<BaseAlarmModuleDto> selectBaseAlarmModuleList(BaseAlarmModule baseAlarmModule)
{
return baseAlarmModuleMapper.selectBaseAlarmModuleList(baseAlarmModule);
}

@ -1,42 +1,74 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.BaseAlarmModuleMapper">
<resultMap type="BaseAlarmModule" id="BaseAlarmModuleResult">
<result property="objId" column="ObjId" />
<result property="alarmmoduleId" column="AlarmModule_Id" />
<result property="alarmmoduleText" column="AlarmModule_Text" />
<result property="monitorunitId" column="MonitorUnit_Id" />
<result property="alarmTypeId" column="AlarmType_Id" />
<result property="enableFlag" column="Enable_Flag" />
<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="objId" column="ObjId"/>
<result property="alarmmoduleId" column="AlarmModule_Id"/>
<result property="alarmmoduleText" column="AlarmModule_Text"/>
<result property="monitorunitId" column="MonitorUnit_Id"/>
<result property="alarmTypeId" column="AlarmType_Id"/>
<result property="enableFlag" column="Enable_Flag"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<resultMap type="BaseAlarmModuleDto" id="BaseAlarmModuleDtoResult">
<result property="objId" column="ObjId"/>
<result property="alarmmoduleId" column="AlarmModule_Id"/>
<result property="alarmmoduleText" column="AlarmModule_Text"/>
<result property="monitorunitId" column="MonitorUnit_Id"/>
<result property="alarmTypeId" column="AlarmType_Id"/>
<result property="alarmTypeName" column="AlarmType_Name"/>
<result property="monitorunitName" column="MonitorUnit_Name"/>
<result property="alarmTypeId" column="AlarmType_Id"/>
<result property="enableFlag" column="Enable_Flag"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<sql id="selectBaseAlarmModuleVo">
select ObjId, AlarmModule_Id, AlarmModule_Text, MonitorUnit_Id,AlarmType_Id, Enable_Flag, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME from base_alarm_module
-- select ObjId, AlarmModule_Id, AlarmModule_Text, MonitorUnit_Id,AlarmType_Id, Enable_Flag, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME from base_alarm_module
select t1.ObjId,
t1.AlarmModule_Id,
t1.AlarmModule_Text,
t1.MonitorUnit_Id,
t2.MonitorUnit_Name,
t1.AlarmType_Id,
t3.AlarmType_Name,
t1.Enable_Flag,
t1.CREATED_BY,
t1.CREATED_TIME,
t1.UPDATED_BY,
t1.UPDATED_TIME
from base_alarm_module t1
left join base_monitorunit_info t2 on t1.MonitorUnit_Id = t2.MonitorUnit_Id
left join base_alarm_type t3 on t1.AlarmType_Id = t3.alarmType_Id
</sql>
<select id="selectBaseAlarmModuleList" parameterType="BaseAlarmModule" resultMap="BaseAlarmModuleResult">
<select id="selectBaseAlarmModuleList" parameterType="BaseAlarmModule" resultMap="BaseAlarmModuleDtoResult">
<include refid="selectBaseAlarmModuleVo"/>
<where>
<if test="alarmmoduleId != null and alarmmoduleId != ''"> and AlarmModule_Id = #{alarmmoduleId}</if>
<if test="alarmmoduleText != null and alarmmoduleText != ''"> and AlarmModule_Text = #{alarmmoduleText}</if>
<if test="monitorunitId != null and monitorunitId != ''"> and MonitorUnit_Id = #{monitorunitId}</if>
<if test="alarmTypeId != null and alarmTypeId != ''"> and AlarmType_Id = #{alarmTypeId}</if>
<if test="enableFlag != null "> and Enable_Flag = #{enableFlag}</if>
<where>
<if test="alarmmoduleId != null and alarmmoduleId != ''">and t1.AlarmModule_Id = #{alarmmoduleId}</if>
<if test="alarmmoduleText != null and alarmmoduleText != ''">and t1.AlarmModule_Text = #{alarmmoduleText}</if>
<if test="monitorunitId != null and monitorunitId != ''">and t1.MonitorUnit_Id = #{monitorunitId}</if>
<if test="alarmTypeId != null and alarmTypeId != ''">and t1.AlarmType_Id = #{alarmTypeId}</if>
<if test="enableFlag != null ">and t1.Enable_Flag = #{enableFlag}</if>
</where>
</select>
<select id="selectBaseAlarmModuleByObjId" parameterType="String" resultMap="BaseAlarmModuleResult">
<select id="selectBaseAlarmModuleByObjId" parameterType="String" resultMap="BaseAlarmModuleDtoResult">
<include refid="selectBaseAlarmModuleVo"/>
where ObjId = #{objId}
where t1.ObjId = #{objId}
</select>
<insert id="insertBaseAlarmModule" parameterType="BaseAlarmModule">
insert into base_alarm_module
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -50,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createdTime != null">CREATED_TIME,</if>
<if test="updatedBy != null">UPDATED_BY,</if>
<if test="updatedTime != null">UPDATED_TIME,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="objId != null">#{objId},</if>
<if test="alarmmoduleId != null">#{alarmmoduleId},</if>
@ -62,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
</trim>
</trim>
</insert>
<update id="updateBaseAlarmModule" parameterType="BaseAlarmModule">
@ -82,11 +114,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteBaseAlarmModuleByObjId" parameterType="String">
delete from base_alarm_module where ObjId = #{objId}
delete
from base_alarm_module
where ObjId = #{objId}
</delete>
<delete id="deleteBaseAlarmModuleByObjIds" parameterType="String">
delete from base_alarm_module where ObjId in
delete from base_alarm_module where ObjId in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>

Loading…
Cancel
Save