forked from dyf/fys-Multi-tenant
查询设备告警列表
This commit is contained in:
@ -24,7 +24,7 @@ public class DeviceAlarmBo extends BaseEntity {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@NotNull(message = "ID不能为空", groups = { EditGroup.class })
|
||||
@NotNull(message = "ID不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
@ -34,14 +34,27 @@ public class DeviceAlarmBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 报警事项
|
||||
* device_action
|
||||
*/
|
||||
private String deviceAction;
|
||||
private Integer deviceAction;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备MAC
|
||||
* device_mac
|
||||
*/
|
||||
private String deviceMac;
|
||||
|
||||
/**
|
||||
* 设备IMEI
|
||||
* device_imei
|
||||
*/
|
||||
private String deviceImei;
|
||||
|
||||
/**
|
||||
* 数据来源
|
||||
*/
|
||||
@ -54,12 +67,12 @@ public class DeviceAlarmBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
* device_type
|
||||
*/
|
||||
private Long deviceType;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
|
||||
*/
|
||||
private Long longitude;
|
||||
|
||||
@ -88,10 +101,18 @@ public class DeviceAlarmBo extends BaseEntity {
|
||||
*/
|
||||
private Date durationTime;
|
||||
|
||||
/**
|
||||
* 报警查询时间
|
||||
*/
|
||||
private Date queryTime1;
|
||||
private Date queryTime2;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 0已处理,1未处理
|
||||
*/
|
||||
private Long treatmentState;
|
||||
private Integer treatmentState;
|
||||
|
||||
|
||||
}
|
||||
|
@ -44,15 +44,24 @@ public class DeviceAlarmVo implements Serializable {
|
||||
|
||||
/**
|
||||
* 报警事项
|
||||
* 0-强制报警,1-撞击闯入,2-手动报警,3-电子围栏告警,4-强制告警
|
||||
*/
|
||||
@ExcelProperty(value = "报警事项")
|
||||
private String deviceAction;
|
||||
private Integer deviceAction;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@ExcelProperty(value = "设备名称")
|
||||
private String deviceName;
|
||||
/**
|
||||
* 设备MAC
|
||||
*/
|
||||
private String deviceMac;
|
||||
/**
|
||||
* 设备IMEI
|
||||
*/
|
||||
private String deviceImei;
|
||||
|
||||
/**
|
||||
* 数据来源
|
||||
@ -71,6 +80,7 @@ public class DeviceAlarmVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "设备类型")
|
||||
private Long deviceType;
|
||||
private String deviceTypeName;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
|
@ -1,8 +1,12 @@
|
||||
package com.fuyuanshen.equipment.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.equipment.domain.DeviceAlarm;
|
||||
import com.fuyuanshen.equipment.domain.bo.DeviceAlarmBo;
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
|
||||
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 设备告警Mapper接口
|
||||
@ -12,4 +16,14 @@ import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
*/
|
||||
public interface DeviceAlarmMapper extends BaseMapperPlus<DeviceAlarm, DeviceAlarmVo> {
|
||||
|
||||
|
||||
/**
|
||||
* 查询设备告警列表
|
||||
*
|
||||
* @param bo 设备告警
|
||||
* @return 设备告警
|
||||
*/
|
||||
Page<DeviceAlarmVo> selectVoPage(@Param("bo") DeviceAlarmBo bo, PageQuery pageQuery);
|
||||
|
||||
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
||||
|
||||
private final DeviceAlarmMapper baseMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询设备告警
|
||||
*
|
||||
@ -40,10 +41,11 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
||||
* @return 设备告警
|
||||
*/
|
||||
@Override
|
||||
public DeviceAlarmVo queryById(Long id){
|
||||
public DeviceAlarmVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询设备告警列表
|
||||
*
|
||||
@ -54,10 +56,12 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
||||
@Override
|
||||
public TableDataInfo<DeviceAlarmVo> queryPageList(DeviceAlarmBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<DeviceAlarm> lqw = buildQueryWrapper(bo);
|
||||
Page<DeviceAlarmVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
// Page<DeviceAlarmVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
Page<DeviceAlarmVo> result = baseMapper.selectVoPage(bo, pageQuery);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备告警列表
|
||||
*
|
||||
@ -75,7 +79,7 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
||||
LambdaQueryWrapper<DeviceAlarm> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(DeviceAlarm::getId);
|
||||
lqw.eq(bo.getDeviceId() != null, DeviceAlarm::getDeviceId, bo.getDeviceId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeviceAction()), DeviceAlarm::getDeviceAction, bo.getDeviceAction());
|
||||
// lqw.eq(StringUtils.isNotBlank(bo.getDeviceAction()), DeviceAlarm::getDeviceAction, bo.getDeviceAction());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), DeviceAlarm::getDeviceName, bo.getDeviceName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDataSource()), DeviceAlarm::getDataSource, bo.getDataSource());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getContent()), DeviceAlarm::getContent, bo.getContent());
|
||||
@ -123,8 +127,8 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(DeviceAlarm entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
private void validEntityBeforeSave(DeviceAlarm entity) {
|
||||
// TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
@ -136,8 +140,8 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
if (isValid) {
|
||||
// TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
@ -1,7 +1,32 @@
|
||||
<?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.fuyuanshen.equipment.mapper.DeviceAlarmMapper">
|
||||
|
||||
<!-- 查询设备告警列表 -->
|
||||
<select id="selectVoPage" resultType="com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo">
|
||||
select *, d.device_mac as deviceMac, d.device_imei as deviceImei,
|
||||
d.type_name as deviceTypeName
|
||||
from device_alarm da
|
||||
left join device d on da.device_id = d.id
|
||||
left join device_type dt on dt.id = da.device_type
|
||||
<where>
|
||||
<if test="bo.deviceName != null">
|
||||
and da.device_name = #{deviceName}
|
||||
</if>
|
||||
<if test="bo.deviceType != null">
|
||||
and da.device_type = #{deviceType}
|
||||
</if>
|
||||
<if test="bo.deviceAction != null">
|
||||
and da.device_action = #{deviceAction}
|
||||
</if>
|
||||
<if test="bo.treatmentState != null">
|
||||
and da.treatmentState = #{bo.treatment_state}
|
||||
</if>
|
||||
<if test="bo.queryTime1 != null and bo.queryTime2 != null ">
|
||||
and da.startTime between #{bo.queryTime1} and #{bo.queryTime2}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
Reference in New Issue
Block a user