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

报警信息搜索

parent b0f0ffea
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.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TDeviceAlarm;
import com.zehong.system.domain.vo.DeviceAlarmVo;
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
......@@ -33,12 +41,12 @@ public class TDeviceAlarmController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:deviceAlarm:list')")
@GetMapping("/list")
public TableDataInfo list(TDeviceAlarm tDeviceAlarm) throws Exception
public TableDataInfo list(DeviceAlarmForm deviceAlarmForm) throws Exception
{
startPage();
List<DeviceAlarmVo> list = null;
try {
list = tDeviceAlarmService.selectTDeviceAlarmList(tDeviceAlarm);
list = tDeviceAlarmService.selectTDeviceAlarmList(deviceAlarmForm);
} catch (Exception e) {
e.printStackTrace();
throw new Exception("查询报警信息列表出错");
......
......@@ -28,7 +28,7 @@ public class WorkOrderVo extends BaseEntity
private String orderType;
/** 源id */
private int resourceId;
private Integer resourceId;
/** 工单名称 */
private String orderName;
......@@ -117,11 +117,11 @@ public class WorkOrderVo extends BaseEntity
return orderType;
}
public int getResourceId() {
public Integer getResourceId() {
return resourceId;
}
public void setResourceId(int resourceId) {
public void setResourceId(Integer resourceId) {
this.resourceId = resourceId;
}
......
......@@ -2,6 +2,7 @@ package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TDeviceAlarm;
import com.zehong.system.domain.form.DeviceAlarmForm;
/**
* 报警信息Mapper接口
......@@ -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 报警信息集合
*/
public List<TDeviceAlarm> selectTDeviceAlarmList(TDeviceAlarm tDeviceAlarm);
public List<TDeviceAlarm> selectTDeviceAlarmByDeviceCode(DeviceAlarmForm deviceAlarmForm);
/**
* 新增报警信息
......
......@@ -2,6 +2,7 @@ package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TDeviceAlarm;
import com.zehong.system.domain.form.DeviceAlarmForm;
import com.zehong.system.domain.vo.DeviceAlarmVo;
/**
......@@ -23,10 +24,10 @@ public interface ITDeviceAlarmService
/**
* 查询报警信息列表
*
* @param tDeviceAlarm 报警信息
* @param deviceAlarmForm 报警信息
* @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;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TPipe;
import com.zehong.system.domain.form.DeviceAlarmForm;
import com.zehong.system.domain.vo.DeviceAlarmVo;
import com.zehong.system.mapper.TDeviceInfoMapper;
import com.zehong.system.mapper.TPipeMapper;
......@@ -69,45 +70,60 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService
/**
* 查询报警信息列表
*
* @param tDeviceAlarm 报警信息
* @param deviceAlarmForm 报警信息
* @return 报警信息
*/
@Override
public List<DeviceAlarmVo> selectTDeviceAlarmList(TDeviceAlarm tDeviceAlarm) throws Exception
public List<DeviceAlarmVo> selectTDeviceAlarmList(DeviceAlarmForm deviceAlarmForm) throws Exception
{
List<DeviceAlarmVo> list = new ArrayList<>();
List<TDeviceAlarm> deviceAlarmList = tDeviceAlarmMapper.selectTDeviceAlarmList(tDeviceAlarm);
List<TDeviceAlarm> deviceAlarmList = new ArrayList<>();
for(TDeviceAlarm alarm : deviceAlarmList){
DeviceAlarmVo deviceAlarmVo = new DeviceAlarmVo();
BeanUtils.copyProperties(alarm, deviceAlarmVo);
if(deviceAlarmForm.getDeviceCode() != null){
List<TDeviceAlarm> pipeList = tDeviceAlarmMapper.selectTDeviceAlarmByPipeCode(deviceAlarmForm);
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())){
TPipe pipe = tPipeMapper.selectTPipeById(alarm.getDeviceId());
if(pipe != null) {
deviceAlarmVo.setDeviceCode(pipe.getPipeCode());
deviceAlarmVo.setDeviceName(pipe.getPipeName());
}
} else {
TDeviceInfo deviceInfo = tDeviceInfoMapper.selectTDeviceInfoById(alarm.getDeviceId());
if(deviceInfo != null) {
deviceAlarmVo.setDeviceCode(deviceInfo.getDeviceCode());
deviceAlarmVo.setDeviceName(deviceInfo.getDeviceName());
if(deviceAlarmList.size() != 0) {
for (TDeviceAlarm alarm : deviceAlarmList) {
DeviceAlarmVo deviceAlarmVo = new DeviceAlarmVo();
BeanUtils.copyProperties(alarm, deviceAlarmVo);
if ("0".equals(alarm.getDeviceType())) {
TPipe pipe = tPipeMapper.selectTPipeById(alarm.getDeviceId());
if (pipe != null) {
deviceAlarmVo.setDeviceCode(pipe.getPipeCode());
deviceAlarmVo.setDeviceName(pipe.getPipeName());
}
} 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");
for(SysDictData sysDictData : sysDictDataList){
if(StringUtils.isNotEmpty(alarm.getAlarmType())){
if(alarm.getAlarmType().equals(sysDictData.getDictValue())){
deviceAlarmVo.setAlarmType(sysDictData.getDictLabel());
List<SysDictData> sysDictDataList = iSysDictTypeService.selectDictDataByType("t_alarm_type");
for (SysDictData sysDictData : sysDictDataList) {
if (StringUtils.isNotEmpty(alarm.getAlarmType())) {
if (alarm.getAlarmType().equals(sysDictData.getDictValue())) {
deviceAlarmVo.setAlarmType(sysDictData.getDictLabel());
}
}
}
list.add(deviceAlarmVo);
}
list.add(deviceAlarmVo);
}
return list;
}
......
......@@ -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
</sql>
<select id="selectTDeviceAlarmList" parameterType="TDeviceAlarm" resultMap="TDeviceAlarmResult">
<select id="selectTDeviceAlarmList" parameterType="DeviceAlarmForm" resultMap="TDeviceAlarmResult">
<include refid="selectTDeviceAlarmVo"/>
<where>
<if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="deviceType != null "> and device_type = #{deviceType}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<where>
<if test="startTime1 != null "> and start_time &gt;= #{startTime1}</if>
<if test="endTime1 != null "> and start_time &lt;= #{endTime1}</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>
</where>
ORDER BY create_time DESC
</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">
<include refid="selectTDeviceAlarmVo"/>
where alarm_id = #{alarmId}
......
<template>
<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-input
v-model="queryParams.deviceCode"
......@@ -10,15 +10,6 @@
@keyup.enter.native="handleQuery"
/>
</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-select v-model="queryParams.alarmType" placeholder="请选择报警类型" clearable size="small">
<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