From f1aad91421319f6421bd00ddd3bffd498c85cdda Mon Sep 17 00:00:00 2001 From: chenyouting <514333061@qq.com> Date: Thu, 11 Sep 2025 14:37:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=91=E5=AE=9A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fuyuanshen/web/service/device/DeviceBizService.java | 5 +++++ .../java/com/fuyuanshen/app/domain/AppDeviceBindRecord.java | 1 + .../src/main/resources/mapper/equipment/DeviceMapper.xml | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBizService.java b/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBizService.java index 21cf14eb..fc355b59 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBizService.java +++ b/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBizService.java @@ -181,12 +181,14 @@ public class DeviceBizService { QueryWrapper bindRecordQueryWrapper = new QueryWrapper<>(); bindRecordQueryWrapper.eq("device_id", device.getId()); + bindRecordQueryWrapper.eq("communication_mode", 0); AppDeviceBindRecord appDeviceBindRecord = appDeviceBindRecordMapper.selectOne(bindRecordQueryWrapper); if (appDeviceBindRecord != null) { UpdateWrapper deviceUpdateWrapper = new UpdateWrapper<>(); deviceUpdateWrapper.eq("device_id", device.getId()) .set("binding_status", BindingStatusEnum.BOUND.getCode()) .set("binding_user_id", userId) + .set("communication_mode", 0) .set("update_time", new Date()) .set("binding_time", new Date()); return appDeviceBindRecordMapper.update(null, deviceUpdateWrapper); @@ -195,6 +197,7 @@ public class DeviceBizService { bindRecord.setDeviceId(device.getId()); bindRecord.setBindingUserId(userId); bindRecord.setBindingTime(new Date()); + bindRecord.setCommunicationMode(0); bindRecord.setCreateBy(userId); appDeviceBindRecordMapper.insert(bindRecord); } @@ -224,6 +227,7 @@ public class DeviceBizService { deviceUpdateWrapper.eq("device_id", device.getId()) .eq("binding_user_id", userId) .set("binding_user_id", userId) + .set("communication_mode", 1) .set("binding_time", new Date()); return appDeviceBindRecordMapper.update(null, deviceUpdateWrapper); } else { @@ -231,6 +235,7 @@ public class DeviceBizService { bindRecord.setDeviceId(device.getId()); bindRecord.setBindingUserId(userId); bindRecord.setBindingTime(new Date()); + bindRecord.setCommunicationMode(1); bindRecord.setCreateBy(userId); appDeviceBindRecordMapper.insert(bindRecord); } diff --git a/fys-modules/fys-app/src/main/java/com/fuyuanshen/app/domain/AppDeviceBindRecord.java b/fys-modules/fys-app/src/main/java/com/fuyuanshen/app/domain/AppDeviceBindRecord.java index d6019213..0bad2abf 100644 --- a/fys-modules/fys-app/src/main/java/com/fuyuanshen/app/domain/AppDeviceBindRecord.java +++ b/fys-modules/fys-app/src/main/java/com/fuyuanshen/app/domain/AppDeviceBindRecord.java @@ -50,5 +50,6 @@ public class AppDeviceBindRecord extends TenantEntity { */ private Date bindingTime; + private Integer communicationMode; } diff --git a/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml b/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml index 81c66744..ef6b6d19 100644 --- a/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml +++ b/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml @@ -254,9 +254,9 @@ c.binding_time from device d inner join device_type dt on d.device_type = dt.id - inner join app_device_bind_record c on d.id = c.device_id + inner join app_device_bind_record c on d.id = c.device_id and c.communication_mode = 0 left join app_personnel_info ap on ap.device_id = d.id - where dt.communication_mode = 0 + where dt.communication_mode in (0, 2) and d.device_type = #{criteria.deviceType}