Commit 29d969ef authored by 王晓倩's avatar 王晓倩

报警信息搜索

parent b0f0ffea
package com.zehong.web.controller.dataMonitoring; package com.zehong.web.controller.dataMonitoring;
import java.util.List;
import com.zehong.system.domain.form.DeviceAlarmForm;
import com.zehong.system.domain.vo.DeviceAlarmVo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log; import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController; import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult; import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo; import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType; import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TDeviceAlarm; import com.zehong.system.domain.TDeviceAlarm;
import com.zehong.system.domain.vo.DeviceAlarmVo;
import com.zehong.system.service.ITDeviceAlarmService; import com.zehong.system.service.ITDeviceAlarmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* 报警信息Controller * 报警信息Controller
...@@ -33,12 +41,12 @@ public class TDeviceAlarmController extends BaseController ...@@ -33,12 +41,12 @@ public class TDeviceAlarmController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('dataMonitoring:deviceAlarm:list')") @PreAuthorize("@ss.hasPermi('dataMonitoring:deviceAlarm:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(TDeviceAlarm tDeviceAlarm) throws Exception public TableDataInfo list(DeviceAlarmForm deviceAlarmForm) throws Exception
{ {
startPage(); startPage();
List<DeviceAlarmVo> list = null; List<DeviceAlarmVo> list = null;
try { try {
list = tDeviceAlarmService.selectTDeviceAlarmList(tDeviceAlarm); list = tDeviceAlarmService.selectTDeviceAlarmList(deviceAlarmForm);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new Exception("查询报警信息列表出错"); throw new Exception("查询报警信息列表出错");
......
...@@ -28,7 +28,7 @@ public class WorkOrderVo extends BaseEntity ...@@ -28,7 +28,7 @@ public class WorkOrderVo extends BaseEntity
private String orderType; private String orderType;
/** 源id */ /** 源id */
private int resourceId; private Integer resourceId;
/** 工单名称 */ /** 工单名称 */
private String orderName; private String orderName;
...@@ -117,11 +117,11 @@ public class WorkOrderVo extends BaseEntity ...@@ -117,11 +117,11 @@ public class WorkOrderVo extends BaseEntity
return orderType; return orderType;
} }
public int getResourceId() { public Integer getResourceId() {
return resourceId; return resourceId;
} }
public void setResourceId(int resourceId) { public void setResourceId(Integer resourceId) {
this.resourceId = resourceId; this.resourceId = resourceId;
} }
......
...@@ -2,6 +2,7 @@ package com.zehong.system.mapper; ...@@ -2,6 +2,7 @@ package com.zehong.system.mapper;
import java.util.List; import java.util.List;
import com.zehong.system.domain.TDeviceAlarm; import com.zehong.system.domain.TDeviceAlarm;
import com.zehong.system.domain.form.DeviceAlarmForm;
/** /**
* 报警信息Mapper接口 * 报警信息Mapper接口
...@@ -22,10 +23,26 @@ public interface TDeviceAlarmMapper ...@@ -22,10 +23,26 @@ public interface TDeviceAlarmMapper
/** /**
* 查询报警信息列表 * 查询报警信息列表
* *
* @param tDeviceAlarm 报警信息 * @param deviceAlarmForm 报警信息
* @return 报警信息集合
*/
public List<TDeviceAlarm> selectTDeviceAlarmList(DeviceAlarmForm deviceAlarmForm);
/**
* 查询报警信息列表
*
* @param deviceAlarmForm 报警信息
* @return 报警信息集合
*/
public List<TDeviceAlarm> selectTDeviceAlarmByPipeCode(DeviceAlarmForm deviceAlarmForm);
/**
* 查询报警信息列表
*
* @param deviceAlarmForm 报警信息
* @return 报警信息集合 * @return 报警信息集合
*/ */
public List<TDeviceAlarm> selectTDeviceAlarmList(TDeviceAlarm tDeviceAlarm); public List<TDeviceAlarm> selectTDeviceAlarmByDeviceCode(DeviceAlarmForm deviceAlarmForm);
/** /**
* 新增报警信息 * 新增报警信息
......
...@@ -2,6 +2,7 @@ package com.zehong.system.service; ...@@ -2,6 +2,7 @@ package com.zehong.system.service;
import java.util.List; import java.util.List;
import com.zehong.system.domain.TDeviceAlarm; import com.zehong.system.domain.TDeviceAlarm;
import com.zehong.system.domain.form.DeviceAlarmForm;
import com.zehong.system.domain.vo.DeviceAlarmVo; import com.zehong.system.domain.vo.DeviceAlarmVo;
/** /**
...@@ -23,10 +24,10 @@ public interface ITDeviceAlarmService ...@@ -23,10 +24,10 @@ public interface ITDeviceAlarmService
/** /**
* 查询报警信息列表 * 查询报警信息列表
* *
* @param tDeviceAlarm 报警信息 * @param deviceAlarmForm 报警信息
* @return 报警信息集合 * @return 报警信息集合
*/ */
public List<DeviceAlarmVo> selectTDeviceAlarmList(TDeviceAlarm tDeviceAlarm) throws Exception; public List<DeviceAlarmVo> selectTDeviceAlarmList(DeviceAlarmForm deviceAlarmForm) throws Exception;
/** /**
* 新增报警信息 * 新增报警信息
......
...@@ -8,6 +8,7 @@ import com.zehong.common.utils.DateUtils; ...@@ -8,6 +8,7 @@ import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.StringUtils; import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.TDeviceInfo; import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TPipe; import com.zehong.system.domain.TPipe;
import com.zehong.system.domain.form.DeviceAlarmForm;
import com.zehong.system.domain.vo.DeviceAlarmVo; import com.zehong.system.domain.vo.DeviceAlarmVo;
import com.zehong.system.mapper.TDeviceInfoMapper; import com.zehong.system.mapper.TDeviceInfoMapper;
import com.zehong.system.mapper.TPipeMapper; import com.zehong.system.mapper.TPipeMapper;
...@@ -69,45 +70,60 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService ...@@ -69,45 +70,60 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService
/** /**
* 查询报警信息列表 * 查询报警信息列表
* *
* @param tDeviceAlarm 报警信息 * @param deviceAlarmForm 报警信息
* @return 报警信息 * @return 报警信息
*/ */
@Override @Override
public List<DeviceAlarmVo> selectTDeviceAlarmList(TDeviceAlarm tDeviceAlarm) throws Exception public List<DeviceAlarmVo> selectTDeviceAlarmList(DeviceAlarmForm deviceAlarmForm) throws Exception
{ {
List<DeviceAlarmVo> list = new ArrayList<>(); List<DeviceAlarmVo> list = new ArrayList<>();
List<TDeviceAlarm> deviceAlarmList = tDeviceAlarmMapper.selectTDeviceAlarmList(tDeviceAlarm); List<TDeviceAlarm> deviceAlarmList = new ArrayList<>();
for(TDeviceAlarm alarm : deviceAlarmList){ if(deviceAlarmForm.getDeviceCode() != null){
DeviceAlarmVo deviceAlarmVo = new DeviceAlarmVo(); List<TDeviceAlarm> pipeList = tDeviceAlarmMapper.selectTDeviceAlarmByPipeCode(deviceAlarmForm);
BeanUtils.copyProperties(alarm, deviceAlarmVo); List<TDeviceAlarm> deviceList = tDeviceAlarmMapper.selectTDeviceAlarmByDeviceCode(deviceAlarmForm);
if(pipeList.size() != 0){
deviceAlarmList.addAll(pipeList);
}
if(deviceList.size() != 0){
deviceAlarmList.addAll(deviceList);
}
} else {
deviceAlarmList = tDeviceAlarmMapper.selectTDeviceAlarmList(deviceAlarmForm);
}
if("0".equals(alarm.getDeviceType())){ if(deviceAlarmList.size() != 0) {
TPipe pipe = tPipeMapper.selectTPipeById(alarm.getDeviceId()); for (TDeviceAlarm alarm : deviceAlarmList) {
if(pipe != null) { DeviceAlarmVo deviceAlarmVo = new DeviceAlarmVo();
deviceAlarmVo.setDeviceCode(pipe.getPipeCode()); BeanUtils.copyProperties(alarm, deviceAlarmVo);
deviceAlarmVo.setDeviceName(pipe.getPipeName());
} if ("0".equals(alarm.getDeviceType())) {
} else { TPipe pipe = tPipeMapper.selectTPipeById(alarm.getDeviceId());
TDeviceInfo deviceInfo = tDeviceInfoMapper.selectTDeviceInfoById(alarm.getDeviceId()); if (pipe != null) {
if(deviceInfo != null) { deviceAlarmVo.setDeviceCode(pipe.getPipeCode());
deviceAlarmVo.setDeviceCode(deviceInfo.getDeviceCode()); deviceAlarmVo.setDeviceName(pipe.getPipeName());
deviceAlarmVo.setDeviceName(deviceInfo.getDeviceName()); }
} else {
TDeviceInfo deviceInfo = tDeviceInfoMapper.selectTDeviceInfoById(alarm.getDeviceId());
if (deviceInfo != null) {
deviceAlarmVo.setDeviceCode(deviceInfo.getDeviceCode());
deviceAlarmVo.setDeviceName(deviceInfo.getDeviceName());
}
} }
}
List<SysDictData> sysDictDataList = iSysDictTypeService.selectDictDataByType("t_alarm_type"); List<SysDictData> sysDictDataList = iSysDictTypeService.selectDictDataByType("t_alarm_type");
for(SysDictData sysDictData : sysDictDataList){ for (SysDictData sysDictData : sysDictDataList) {
if(StringUtils.isNotEmpty(alarm.getAlarmType())){ if (StringUtils.isNotEmpty(alarm.getAlarmType())) {
if(alarm.getAlarmType().equals(sysDictData.getDictValue())){ if (alarm.getAlarmType().equals(sysDictData.getDictValue())) {
deviceAlarmVo.setAlarmType(sysDictData.getDictLabel()); deviceAlarmVo.setAlarmType(sysDictData.getDictLabel());
}
} }
} }
list.add(deviceAlarmVo);
} }
list.add(deviceAlarmVo);
} }
return list; return list;
} }
......
...@@ -22,21 +22,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -22,21 +22,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select alarm_id, device_id, device_type, order_id, alarm_type, alarm_value, start_time, end_time, deal_status, update_time, create_time from t_device_alarm select alarm_id, device_id, device_type, order_id, alarm_type, alarm_value, start_time, end_time, deal_status, update_time, create_time from t_device_alarm
</sql> </sql>
<select id="selectTDeviceAlarmList" parameterType="TDeviceAlarm" resultMap="TDeviceAlarmResult"> <select id="selectTDeviceAlarmList" parameterType="DeviceAlarmForm" resultMap="TDeviceAlarmResult">
<include refid="selectTDeviceAlarmVo"/> <include refid="selectTDeviceAlarmVo"/>
<where> <where>
<if test="deviceId != null "> and device_id = #{deviceId}</if> <if test="startTime1 != null "> and start_time &gt;= #{startTime1}</if>
<if test="deviceType != null "> and device_type = #{deviceType}</if> <if test="endTime1 != null "> and start_time &lt;= #{endTime1}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="alarmType != null and alarmType != ''"> and alarm_type = #{alarmType}</if> <if test="alarmType != null and alarmType != ''"> and alarm_type = #{alarmType}</if>
<if test="alarmValue != null and alarmValue != ''"> and alarm_value = #{alarmValue}</if>
<if test="startTime != null "> and start_time = #{startTime}</if>
<if test="endTime != null "> and end_time = #{endTime}</if>
<if test="dealStatus != null and dealStatus != ''"> and deal_status = #{dealStatus}</if> <if test="dealStatus != null and dealStatus != ''"> and deal_status = #{dealStatus}</if>
</where> </where>
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
<select id="selectTDeviceAlarmByPipeCode" parameterType="DeviceAlarmForm" resultMap="TDeviceAlarmResult">
select t.alarm_id, t.device_id, t.device_type, t.order_id, t.alarm_type, t.alarm_value, t.start_time, t.end_time, t.deal_status, t.update_time, t.create_time
from t_device_alarm t
left join t_pipe p on t.device_id = p.pipe_id
<where>
<if test="deviceCode != null "> and p.pipe_code like concat('%',#{deviceCode},'%')</if>
<if test="startTime1 != null "> and t.start_time &gt;= #{startTime1}</if>
<if test="endTime1 != null "> and t.start_time &lt;= #{endTime1}</if>
<if test="alarmType != null and alarmType != ''"> and t.alarm_type = #{alarmType}</if>
<if test="dealStatus != null and dealStatus != ''"> and t.deal_status = #{dealStatus}</if>
</where>
ORDER BY create_time DESC
</select>
<select id="selectTDeviceAlarmByDeviceCode" parameterType="DeviceAlarmForm" resultMap="TDeviceAlarmResult">
select t.alarm_id, t.device_id, t.device_type, t.order_id, t.alarm_type, t.alarm_value, t.start_time, t.end_time, t.deal_status, t.update_time, t.create_time
from t_device_alarm t
left join t_device_info d on t.device_id = d.device_id
<where>
<if test="deviceCode != null "> and d.device_code like concat('%',#{deviceCode},'%')</if>
<if test="startTime1 != null "> and t.start_time &gt;= #{startTime1}</if>
<if test="endTime1 != null "> and t.start_time &lt;= #{endTime1}</if>
<if test="alarmType != null and alarmType != ''"> and t.alarm_type = #{alarmType}</if>
<if test="dealStatus != null and dealStatus != ''"> and t.deal_status = #{dealStatus}</if>
</where>
ORDER BY create_time DESC
</select>
<select id="selectTDeviceAlarmById" parameterType="int" resultMap="TDeviceAlarmResult"> <select id="selectTDeviceAlarmById" parameterType="int" resultMap="TDeviceAlarmResult">
<include refid="selectTDeviceAlarmVo"/> <include refid="selectTDeviceAlarmVo"/>
where alarm_id = #{alarmId} where alarm_id = #{alarmId}
......
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="设备编号" prop="deviceCode"> <el-form-item label="设备编号" prop="deviceCode">
<el-input <el-input
v-model="queryParams.deviceCode" v-model="queryParams.deviceCode"
...@@ -10,15 +10,6 @@ ...@@ -10,15 +10,6 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="管道编号" prop="pipeCode">
<el-input
v-model="queryParams.pipeCode"
placeholder="请输入管道编号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="报警类型" prop="alarmType"> <el-form-item label="报警类型" prop="alarmType">
<el-select v-model="queryParams.alarmType" placeholder="请选择报警类型" clearable size="small"> <el-select v-model="queryParams.alarmType" placeholder="请选择报警类型" clearable size="small">
<el-option <el-option
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment