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