From bb11bc4dfa3824186f72bd6460aa873f261a5ad9 Mon Sep 17 00:00:00 2001 From: daiyongfei <974332738@qq.com> Date: Wed, 20 Aug 2025 15:13:43 +0800 Subject: [PATCH] =?UTF-8?q?WEB=E7=AB=AF=E8=A7=A3=E7=BB=91=E8=AE=BE?= =?UTF-8?q?=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/WEBDeviceController.java | 6 ++--- .../service/impl/WEBDeviceServiceImpl.java | 24 ++++++++++++++++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WEBDeviceController.java b/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WEBDeviceController.java index 0d19676..71be510 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WEBDeviceController.java +++ b/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WEBDeviceController.java @@ -38,6 +38,7 @@ public class WEBDeviceController extends BaseController { private final WEBDeviceService deviceService; private final DeviceBizService appDeviceService; + /** * @param id * @return @@ -52,14 +53,12 @@ public class WEBDeviceController extends BaseController { } - - /** * 查询设备列表 */ @GetMapping("/list") public TableDataInfo list(DeviceQueryCriteria bo, PageQuery pageQuery) { - return appDeviceService.queryAppDeviceList(bo,pageQuery); + return appDeviceService.queryAppDeviceList(bo, pageQuery); } /** @@ -90,6 +89,7 @@ public class WEBDeviceController extends BaseController { /** * 重命名设备 + * * @param reNameDTO * @return */ diff --git a/fys-admin/src/main/java/com/fuyuanshen/web/service/impl/WEBDeviceServiceImpl.java b/fys-admin/src/main/java/com/fuyuanshen/web/service/impl/WEBDeviceServiceImpl.java index f38a2e8..7e328b8 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/web/service/impl/WEBDeviceServiceImpl.java +++ b/fys-admin/src/main/java/com/fuyuanshen/web/service/impl/WEBDeviceServiceImpl.java @@ -1,8 +1,13 @@ package com.fuyuanshen.web.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuyuanshen.app.domain.AppDeviceBindRecord; +import com.fuyuanshen.app.mapper.AppDeviceBindRecordMapper; import com.fuyuanshen.equipment.domain.Device; import com.fuyuanshen.equipment.domain.DeviceAssignments; +import com.fuyuanshen.equipment.enums.BindingStatusEnum; import com.fuyuanshen.equipment.mapper.DeviceAssignmentsMapper; import com.fuyuanshen.equipment.mapper.DeviceMapper; import com.fuyuanshen.web.service.WEBDeviceService; @@ -10,6 +15,7 @@ import com.fuyuanshen.web.service.device.DeviceBizService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; /** * @Description: @@ -25,6 +31,10 @@ public class WEBDeviceServiceImpl extends ServiceImpl impl private final DeviceAssignmentsMapper deviceAssignmentsMapper; + private final AppDeviceBindRecordMapper appDeviceBindRecordMapper; + + private final DeviceMapper deviceMapper; + /** * WEB端解绑设备 @@ -33,6 +43,7 @@ public class WEBDeviceServiceImpl extends ServiceImpl impl * @return */ @Override + @Transactional public int webUnBindDevice(Long id, Long userId) { // 设备端解绑 0:设备端解绑 1:web端解绑 int type = 1; @@ -44,7 +55,18 @@ public class WEBDeviceServiceImpl extends ServiceImpl impl id = deviceAssignments.getDeviceId(); type = 0; } - return appDeviceService.unBindDevice(id, userId, type); + + QueryWrapper deviceId = new QueryWrapper().eq("device_id", id); + + // appDeviceService.unBindDevice(id, userId, type); + UpdateWrapper deviceUpdateWrapper = new UpdateWrapper<>(); + deviceUpdateWrapper.eq("id", id) + .set("binding_user_id", null) + .set("binding_status", BindingStatusEnum.UNBOUND.getCode()) + .set("binding_time", null); + deviceMapper.update(null, deviceUpdateWrapper); + + return appDeviceBindRecordMapper.delete(deviceId); }