fix: 设备绑定记录,设备管理,联动控制等,设备编号支持模糊查询。
This commit is contained in:
@@ -95,7 +95,7 @@ public class DeviceBindRecordServiceImpl implements IDeviceBindRecordService {
|
||||
// 基础查询条件
|
||||
wrapper.like(StringUtils.isNotBlank(bo.getIotId()), DeviceBindRecord::getIotId, bo.getIotId());
|
||||
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.getIsBind() != null, DeviceBindRecord::getIsBind, bo.getIsBind());
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class DeviceCorrectRecordServiceImpl implements IDeviceCorrectRecordServi
|
||||
// 查询条件
|
||||
wrapper.eq(bo.getDeviceId() != null, DeviceCorrectRecord::getDeviceId, bo.getDeviceId())
|
||||
.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.getValueDissolvedOxygen() != null, DeviceCorrectRecord::getValueDissolvedOxygen, bo.getValueDissolvedOxygen())
|
||||
.eq(bo.getValueTemperature() != null, DeviceCorrectRecord::getValueTemperature, bo.getValueTemperature())
|
||||
|
||||
@@ -128,7 +128,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
|
||||
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.eq(bo.getDeviceType() != null, Device::getDeviceType, bo.getDeviceType());
|
||||
wrapper.eq(bo.getBindTime() != null, Device::getBindTime, bo.getBindTime());
|
||||
@@ -237,19 +237,19 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
|
||||
|
||||
// 1. 删除设备关联的故障码记录
|
||||
deviceErrorCodeMapper.delete(
|
||||
new LambdaQueryWrapper<DeviceErrorCode>()
|
||||
.in(DeviceErrorCode::getDeviceId, ids)
|
||||
);
|
||||
|
||||
|
||||
// 2. 删除设备关联的校准记录
|
||||
deviceCorrectRecordMapper.delete(
|
||||
new LambdaQueryWrapper<DeviceCorrectRecord>()
|
||||
.in(DeviceCorrectRecord::getDeviceId, ids)
|
||||
);
|
||||
|
||||
|
||||
// 3. 查询设备关联的开关
|
||||
List<DeviceSwitch> switches = deviceSwitchMapper.selectList(
|
||||
new LambdaQueryWrapper<DeviceSwitch>()
|
||||
@@ -307,7 +307,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
List<Device> devicesToDelete = baseMapper.selectList(
|
||||
new LambdaQueryWrapper<Device>()
|
||||
.in(Device::getId, ids)
|
||||
.select(Device::getId, Device::getUserId, Device::getIotId,
|
||||
.select(Device::getId, Device::getUserId, Device::getIotId,
|
||||
Device::getDeviceType, Device::getSerialNum)
|
||||
);
|
||||
|
||||
@@ -321,7 +321,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
unbindRecord.setDeviceType(device.getDeviceType() != null ? Long.valueOf(device.getDeviceType()) : null);
|
||||
unbindRecord.setSerialNum(device.getSerialNum());
|
||||
deviceBindRecordMapper.insert(unbindRecord);
|
||||
log.info("添加设备解绑记录: deviceId={}, userId={}, serialNum={}",
|
||||
log.info("添加设备解绑记录: deviceId={}, userId={}, serialNum={}",
|
||||
device.getId(), device.getUserId(), device.getSerialNum());
|
||||
} catch (Exception e) {
|
||||
log.error("添加设备解绑记录失败: deviceId={}, error={}", device.getId(), e.getMessage(), e);
|
||||
|
||||
@@ -81,7 +81,7 @@ public class DeviceWarnCombineServiceImpl implements IDeviceWarnCombineService {
|
||||
.selectAll(DeviceWarnCombine.class)
|
||||
.selectCount(DeviceWarnOne::getId, DeviceWarnCombineVo::getTotalCount)
|
||||
.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.getThresholdType() != null, DeviceWarnCombine::getThresholdType, bo.getThresholdType())
|
||||
.eq(bo.getProcessStatus() != null, DeviceWarnCombine::getProcessStatus, bo.getProcessStatus())
|
||||
|
||||
@@ -154,6 +154,10 @@ public class LinkedCtrlServiceImpl implements ILinkedCtrlService {
|
||||
.eq(bo.getOxyUpperOpen() != null, LinkedCtrl::getOxyUpperOpen, bo.getOxyUpperOpen())
|
||||
.eq(bo.getOxyLowerOpen() != null, LinkedCtrl::getOxyLowerOpen, bo.getOxyLowerOpen())
|
||||
.eq(bo.getIsOxyUpperTrigger() != null, LinkedCtrl::getIsOxyUpperTrigger, bo.getIsOxyUpperTrigger());
|
||||
// 处理额外的查询参数
|
||||
if (params != null && !params.isEmpty()) {
|
||||
handleExtraParams(wrapper, params);
|
||||
}
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user