fix: 扫描设备二维码,bug修复。

This commit is contained in:
tianyongbao
2026-01-20 18:21:28 +08:00
parent 0a9e808b6f
commit ae20a13add

View File

@@ -824,19 +824,19 @@ public class DeviceController extends BaseController {
.eq(LinkedCtrl::getDeviceId, device.getId())
.select(LinkedCtrl::getId)
);
if (!linkedCtrls.isEmpty()) {
List<Long> linkedCtrlIds = linkedCtrls.stream()
.map(LinkedCtrl::getId)
.collect(Collectors.toList());
// 2. 解除关联的开关绑定
deviceSwitchMapper.update(null,
new LambdaUpdateWrapper<DeviceSwitch>()
.set(DeviceSwitch::getLinkedCtrlId, null)
.in(DeviceSwitch::getLinkedCtrlId, linkedCtrlIds)
);
// 3. 删除联动控制记录
linkedCtrlMapper.delete(
new LambdaQueryWrapper<LinkedCtrl>()
@@ -985,19 +985,19 @@ public class DeviceController extends BaseController {
.eq(LinkedCtrl::getDeviceId, request.getId())
.select(LinkedCtrl::getId)
);
if (!linkedCtrls.isEmpty()) {
List<Long> linkedCtrlIds = linkedCtrls.stream()
.map(LinkedCtrl::getId)
.collect(Collectors.toList());
// 2. 解除关联的开关绑定
deviceSwitchMapper.update(null,
new LambdaUpdateWrapper<DeviceSwitch>()
.set(DeviceSwitch::getLinkedCtrlId, null)
.in(DeviceSwitch::getLinkedCtrlId, linkedCtrlIds)
);
// 3. 删除联动控制记录
linkedCtrlMapper.delete(
new LambdaQueryWrapper<LinkedCtrl>()
@@ -1048,13 +1048,11 @@ public class DeviceController extends BaseController {
* 检查设备二维码,解析设备类型和序列号
* 二维码格式pk=xxxxx&dn=xxxxx
*
* @param rootUserId 用户ID预留参数
* @param qrCode 设备二维码内容
* @return 设备类型和序列号
*/
@GetMapping("/check_device_qrcode")
public R<PublicDeviceTypeAndSerialNum> checkDeviceQrcode(
@RequestParam("rootUserId") Long rootUserId,
@RequestParam("qrCode") String qrCode) {
// 验证二维码不能为空