查询设备告警列表

This commit is contained in:
2025-08-29 13:59:23 +08:00
parent 3969e50566
commit e17a64ad57
5 changed files with 88 additions and 14 deletions

View File

@ -24,7 +24,7 @@ public class DeviceAlarmBo extends BaseEntity {
/** /**
* ID * ID
*/ */
@NotNull(message = "ID不能为空", groups = { EditGroup.class }) @NotNull(message = "ID不能为空", groups = {EditGroup.class})
private Long id; private Long id;
/** /**
@ -34,14 +34,27 @@ public class DeviceAlarmBo extends BaseEntity {
/** /**
* 报警事项 * 报警事项
* device_action
*/ */
private String deviceAction; private Integer deviceAction;
/** /**
* 设备名称 * 设备名称
*/ */
private String deviceName; 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 deviceType;
/** /**
* 经度 * 经度
*/ */
private Long longitude; private Long longitude;
@ -88,10 +101,18 @@ public class DeviceAlarmBo extends BaseEntity {
*/ */
private Date durationTime; private Date durationTime;
/**
* 报警查询时间
*/
private Date queryTime1;
private Date queryTime2;
/** /**
* 0已处理1未处理 * 0已处理1未处理
*/ */
private Long treatmentState; private Integer treatmentState;
} }

View File

@ -44,15 +44,24 @@ public class DeviceAlarmVo implements Serializable {
/** /**
* 报警事项 * 报警事项
* 0-强制报警1-撞击闯入2-手动报警3-电子围栏告警4-强制告警
*/ */
@ExcelProperty(value = "报警事项") @ExcelProperty(value = "报警事项")
private String deviceAction; private Integer deviceAction;
/** /**
* 设备名称 * 设备名称
*/ */
@ExcelProperty(value = "设备名称") @ExcelProperty(value = "设备名称")
private String deviceName; private String deviceName;
/**
* 设备MAC
*/
private String deviceMac;
/**
* 设备IMEI
*/
private String deviceImei;
/** /**
* 数据来源 * 数据来源
@ -71,6 +80,7 @@ public class DeviceAlarmVo implements Serializable {
*/ */
@ExcelProperty(value = "设备类型") @ExcelProperty(value = "设备类型")
private Long deviceType; private Long deviceType;
private String deviceTypeName;
/** /**
* 经度 * 经度

View File

@ -1,8 +1,12 @@
package com.fuyuanshen.equipment.mapper; 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.DeviceAlarm;
import com.fuyuanshen.equipment.domain.bo.DeviceAlarmBo;
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo; import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus; import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
/** /**
* 设备告警Mapper接口 * 设备告警Mapper接口
@ -12,4 +16,14 @@ import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
*/ */
public interface DeviceAlarmMapper extends BaseMapperPlus<DeviceAlarm, DeviceAlarmVo> { public interface DeviceAlarmMapper extends BaseMapperPlus<DeviceAlarm, DeviceAlarmVo> {
/**
* 查询设备告警列表
*
* @param bo 设备告警
* @return 设备告警
*/
Page<DeviceAlarmVo> selectVoPage(@Param("bo") DeviceAlarmBo bo, PageQuery pageQuery);
} }

View File

@ -33,6 +33,7 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
private final DeviceAlarmMapper baseMapper; private final DeviceAlarmMapper baseMapper;
/** /**
* 查询设备告警 * 查询设备告警
* *
@ -40,10 +41,11 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
* @return 设备告警 * @return 设备告警
*/ */
@Override @Override
public DeviceAlarmVo queryById(Long id){ public DeviceAlarmVo queryById(Long id) {
return baseMapper.selectVoById(id); return baseMapper.selectVoById(id);
} }
/** /**
* 分页查询设备告警列表 * 分页查询设备告警列表
* *
@ -54,10 +56,12 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
@Override @Override
public TableDataInfo<DeviceAlarmVo> queryPageList(DeviceAlarmBo bo, PageQuery pageQuery) { public TableDataInfo<DeviceAlarmVo> queryPageList(DeviceAlarmBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<DeviceAlarm> lqw = buildQueryWrapper(bo); 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); return TableDataInfo.build(result);
} }
/** /**
* 查询符合条件的设备告警列表 * 查询符合条件的设备告警列表
* *
@ -75,7 +79,7 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
LambdaQueryWrapper<DeviceAlarm> lqw = Wrappers.lambdaQuery(); LambdaQueryWrapper<DeviceAlarm> lqw = Wrappers.lambdaQuery();
lqw.orderByAsc(DeviceAlarm::getId); lqw.orderByAsc(DeviceAlarm::getId);
lqw.eq(bo.getDeviceId() != null, DeviceAlarm::getDeviceId, bo.getDeviceId()); 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.like(StringUtils.isNotBlank(bo.getDeviceName()), DeviceAlarm::getDeviceName, bo.getDeviceName());
lqw.eq(StringUtils.isNotBlank(bo.getDataSource()), DeviceAlarm::getDataSource, bo.getDataSource()); lqw.eq(StringUtils.isNotBlank(bo.getDataSource()), DeviceAlarm::getDataSource, bo.getDataSource());
lqw.eq(StringUtils.isNotBlank(bo.getContent()), DeviceAlarm::getContent, bo.getContent()); lqw.eq(StringUtils.isNotBlank(bo.getContent()), DeviceAlarm::getContent, bo.getContent());
@ -123,8 +127,8 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
/** /**
* 保存前的数据校验 * 保存前的数据校验
*/ */
private void validEntityBeforeSave(DeviceAlarm entity){ private void validEntityBeforeSave(DeviceAlarm entity) {
//TODO 做一些数据校验,如唯一约束 // TODO 做一些数据校验,如唯一约束
} }
/** /**
@ -136,8 +140,8 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
*/ */
@Override @Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){ if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验 // TODO 做一些业务上的校验,判断是否需要校验
} }
return baseMapper.deleteByIds(ids) > 0; return baseMapper.deleteByIds(ids) > 0;
} }

View File

@ -1,7 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuyuanshen.equipment.mapper.DeviceAlarmMapper"> <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> </mapper>