fix: 设备绑定记录,设备管理,联动控制等,设备编号支持模糊查询。

This commit is contained in:
tianyongbao
2026-05-02 22:49:21 +08:00
parent feedc121db
commit 7edf220e0a
5 changed files with 13 additions and 9 deletions

View File

@@ -95,7 +95,7 @@ public class DeviceBindRecordServiceImpl implements IDeviceBindRecordService {
// 基础查询条件 // 基础查询条件
wrapper.like(StringUtils.isNotBlank(bo.getIotId()), DeviceBindRecord::getIotId, bo.getIotId()); wrapper.like(StringUtils.isNotBlank(bo.getIotId()), DeviceBindRecord::getIotId, bo.getIotId());
wrapper.eq(bo.getDeviceType() != null, DeviceBindRecord::getDeviceType, bo.getDeviceType()); wrapper.eq(bo.getDeviceType() != null, DeviceBindRecord::getDeviceType, bo.getDeviceType());
wrapper.eq(StringUtils.isNotBlank(bo.getSerialNum()), DeviceBindRecord::getSerialNum, bo.getSerialNum()); wrapper.like(StringUtils.isNotBlank(bo.getSerialNum()), DeviceBindRecord::getSerialNum, bo.getSerialNum());
wrapper.eq(bo.getUserId() != null, DeviceBindRecord::getUserId, bo.getUserId()); wrapper.eq(bo.getUserId() != null, DeviceBindRecord::getUserId, bo.getUserId());
wrapper.eq(bo.getIsBind() != null, DeviceBindRecord::getIsBind, bo.getIsBind()); wrapper.eq(bo.getIsBind() != null, DeviceBindRecord::getIsBind, bo.getIsBind());

View File

@@ -94,7 +94,7 @@ public class DeviceCorrectRecordServiceImpl implements IDeviceCorrectRecordServi
// 查询条件 // 查询条件
wrapper.eq(bo.getDeviceId() != null, DeviceCorrectRecord::getDeviceId, bo.getDeviceId()) wrapper.eq(bo.getDeviceId() != null, DeviceCorrectRecord::getDeviceId, bo.getDeviceId())
.eq(bo.getUserId() != null, DeviceCorrectRecord::getUserId, bo.getUserId()) .eq(bo.getUserId() != null, DeviceCorrectRecord::getUserId, bo.getUserId())
.eq(StringUtils.isNotBlank(bo.getSerialNum()), DeviceCorrectRecord::getSerialNum, bo.getSerialNum()) .like(StringUtils.isNotBlank(bo.getSerialNum()), DeviceCorrectRecord::getSerialNum, bo.getSerialNum())
.eq(bo.getDeviceType() != null, DeviceCorrectRecord::getDeviceType, bo.getDeviceType()) .eq(bo.getDeviceType() != null, DeviceCorrectRecord::getDeviceType, bo.getDeviceType())
.eq(bo.getValueDissolvedOxygen() != null, DeviceCorrectRecord::getValueDissolvedOxygen, bo.getValueDissolvedOxygen()) .eq(bo.getValueDissolvedOxygen() != null, DeviceCorrectRecord::getValueDissolvedOxygen, bo.getValueDissolvedOxygen())
.eq(bo.getValueTemperature() != null, DeviceCorrectRecord::getValueTemperature, bo.getValueTemperature()) .eq(bo.getValueTemperature() != null, DeviceCorrectRecord::getValueTemperature, bo.getValueTemperature())

View File

@@ -128,7 +128,7 @@ public class DeviceServiceImpl implements IDeviceService {
} }
wrapper.eq(bo.getUserId() != null, Device::getUserId, bo.getUserId()); wrapper.eq(bo.getUserId() != null, Device::getUserId, bo.getUserId());
wrapper.eq(StringUtils.isNotBlank(bo.getSerialNum()), Device::getSerialNum, bo.getSerialNum()); wrapper.like(StringUtils.isNotBlank(bo.getSerialNum()), Device::getSerialNum, bo.getSerialNum());
wrapper.like(StringUtils.isNotBlank(bo.getDeviceName()), Device::getDeviceName, bo.getDeviceName()); wrapper.like(StringUtils.isNotBlank(bo.getDeviceName()), Device::getDeviceName, bo.getDeviceName());
wrapper.eq(bo.getDeviceType() != null, Device::getDeviceType, bo.getDeviceType()); wrapper.eq(bo.getDeviceType() != null, Device::getDeviceType, bo.getDeviceType());
wrapper.eq(bo.getBindTime() != null, Device::getBindTime, bo.getBindTime()); wrapper.eq(bo.getBindTime() != null, Device::getBindTime, bo.getBindTime());
@@ -237,19 +237,19 @@ public class DeviceServiceImpl implements IDeviceService {
if(isValid){ if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验 //TODO 做一些业务上的校验,判断是否需要校验
} }
// 1. 删除设备关联的故障码记录 // 1. 删除设备关联的故障码记录
deviceErrorCodeMapper.delete( deviceErrorCodeMapper.delete(
new LambdaQueryWrapper<DeviceErrorCode>() new LambdaQueryWrapper<DeviceErrorCode>()
.in(DeviceErrorCode::getDeviceId, ids) .in(DeviceErrorCode::getDeviceId, ids)
); );
// 2. 删除设备关联的校准记录 // 2. 删除设备关联的校准记录
deviceCorrectRecordMapper.delete( deviceCorrectRecordMapper.delete(
new LambdaQueryWrapper<DeviceCorrectRecord>() new LambdaQueryWrapper<DeviceCorrectRecord>()
.in(DeviceCorrectRecord::getDeviceId, ids) .in(DeviceCorrectRecord::getDeviceId, ids)
); );
// 3. 查询设备关联的开关 // 3. 查询设备关联的开关
List<DeviceSwitch> switches = deviceSwitchMapper.selectList( List<DeviceSwitch> switches = deviceSwitchMapper.selectList(
new LambdaQueryWrapper<DeviceSwitch>() new LambdaQueryWrapper<DeviceSwitch>()
@@ -307,7 +307,7 @@ public class DeviceServiceImpl implements IDeviceService {
List<Device> devicesToDelete = baseMapper.selectList( List<Device> devicesToDelete = baseMapper.selectList(
new LambdaQueryWrapper<Device>() new LambdaQueryWrapper<Device>()
.in(Device::getId, ids) .in(Device::getId, ids)
.select(Device::getId, Device::getUserId, Device::getIotId, .select(Device::getId, Device::getUserId, Device::getIotId,
Device::getDeviceType, Device::getSerialNum) Device::getDeviceType, Device::getSerialNum)
); );
@@ -321,7 +321,7 @@ public class DeviceServiceImpl implements IDeviceService {
unbindRecord.setDeviceType(device.getDeviceType() != null ? Long.valueOf(device.getDeviceType()) : null); unbindRecord.setDeviceType(device.getDeviceType() != null ? Long.valueOf(device.getDeviceType()) : null);
unbindRecord.setSerialNum(device.getSerialNum()); unbindRecord.setSerialNum(device.getSerialNum());
deviceBindRecordMapper.insert(unbindRecord); deviceBindRecordMapper.insert(unbindRecord);
log.info("添加设备解绑记录: deviceId={}, userId={}, serialNum={}", log.info("添加设备解绑记录: deviceId={}, userId={}, serialNum={}",
device.getId(), device.getUserId(), device.getSerialNum()); device.getId(), device.getUserId(), device.getSerialNum());
} catch (Exception e) { } catch (Exception e) {
log.error("添加设备解绑记录失败: deviceId={}, error={}", device.getId(), e.getMessage(), e); log.error("添加设备解绑记录失败: deviceId={}, error={}", device.getId(), e.getMessage(), e);

View File

@@ -81,7 +81,7 @@ public class DeviceWarnCombineServiceImpl implements IDeviceWarnCombineService {
.selectAll(DeviceWarnCombine.class) .selectAll(DeviceWarnCombine.class)
.selectCount(DeviceWarnOne::getId, DeviceWarnCombineVo::getTotalCount) .selectCount(DeviceWarnOne::getId, DeviceWarnCombineVo::getTotalCount)
.leftJoin(DeviceWarnOne.class, DeviceWarnOne::getWarnCombineId, DeviceWarnCombine::getId) .leftJoin(DeviceWarnOne.class, DeviceWarnOne::getWarnCombineId, DeviceWarnCombine::getId)
.eq(StringUtils.isNotBlank(bo.getDeviceSerialNum()), DeviceWarnCombine::getDeviceSerialNum, bo.getDeviceSerialNum()) .like(StringUtils.isNotBlank(bo.getDeviceSerialNum()), DeviceWarnCombine::getDeviceSerialNum, bo.getDeviceSerialNum())
.eq(bo.getDeviceType() != null, DeviceWarnCombine::getDeviceType, bo.getDeviceType()) .eq(bo.getDeviceType() != null, DeviceWarnCombine::getDeviceType, bo.getDeviceType())
.eq(bo.getThresholdType() != null, DeviceWarnCombine::getThresholdType, bo.getThresholdType()) .eq(bo.getThresholdType() != null, DeviceWarnCombine::getThresholdType, bo.getThresholdType())
.eq(bo.getProcessStatus() != null, DeviceWarnCombine::getProcessStatus, bo.getProcessStatus()) .eq(bo.getProcessStatus() != null, DeviceWarnCombine::getProcessStatus, bo.getProcessStatus())

View File

@@ -154,6 +154,10 @@ public class LinkedCtrlServiceImpl implements ILinkedCtrlService {
.eq(bo.getOxyUpperOpen() != null, LinkedCtrl::getOxyUpperOpen, bo.getOxyUpperOpen()) .eq(bo.getOxyUpperOpen() != null, LinkedCtrl::getOxyUpperOpen, bo.getOxyUpperOpen())
.eq(bo.getOxyLowerOpen() != null, LinkedCtrl::getOxyLowerOpen, bo.getOxyLowerOpen()) .eq(bo.getOxyLowerOpen() != null, LinkedCtrl::getOxyLowerOpen, bo.getOxyLowerOpen())
.eq(bo.getIsOxyUpperTrigger() != null, LinkedCtrl::getIsOxyUpperTrigger, bo.getIsOxyUpperTrigger()); .eq(bo.getIsOxyUpperTrigger() != null, LinkedCtrl::getIsOxyUpperTrigger, bo.getIsOxyUpperTrigger());
// 处理额外的查询参数
if (params != null && !params.isEmpty()) {
handleExtraParams(wrapper, params);
}
return wrapper; return wrapper;
} }