diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisAccessControlServiceImpl.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisAccessControlServiceImpl.java index 9cbe0b2a..79d435f0 100644 --- a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisAccessControlServiceImpl.java +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisAccessControlServiceImpl.java @@ -142,7 +142,6 @@ public class SisAccessControlServiceImpl implements ISisAccessControlService { SisAccessControl update = MapstructUtils.convert(bo, SisAccessControl.class); boolean b = baseMapper.updateById(update) > 0; if (bo.getBindDeviceId() != null) { - // 检验设备是否存在 SisDeviceManageVo sisDeviceManageVo = sisDeviceManageService.queryById(bo.getBindDeviceId()); Assert.isTrue(sisDeviceManageVo != null, "设备-{}信息不存在.", bo.getBindDeviceId()); @@ -158,6 +157,9 @@ public class SisAccessControlServiceImpl implements ISisAccessControlService { // 重新构建绑定关系 Boolean insert = sisDeviceBindRefService.insert(sisDeviceBindRef); Assert.isTrue(insert, "写入设备关联表失败!"); + } else { + // 删除设备绑定关系 + sisDeviceBindRefService.deleteByBindId(bo.getId()); } if (CollUtil.isNotEmpty(bo.getDevicePoint())) { @@ -178,6 +180,10 @@ public class SisAccessControlServiceImpl implements ISisAccessControlService { // 构建新的关联关系 Boolean b2 = sisAcDeviceRefService.batchInsert(refs); log.info("门禁-监控设备关联关系构建完成, result={}", b2); + } else { + // 删除监控点管理 + Boolean b1 = sisAcDeviceRefService.deleteByAcId(bo.getId()); + log.info("门禁-监控关联关系删除完成, result={}, acId={}", b1, bo.getId()); } return b; }