| | |
| | | if (deviceCode == null) { |
| | | throw new BusinessException("设备编号不能为空"); |
| | | } |
| | | //查灯杆归属关系 |
| | | boolean belong = isBelong(deviceCode, null); |
| | | if(!belong){ |
| | | throw new BusinessException("该灯杆不属于您,无法解绑!"); |
| | | } |
| | | //直接删除设备不需要灯杆ID |
| | | PoleBinding one = getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, deviceCode)); |
| | | |
| | |
| | | * |
| | | * @param deviceCode 设备编号 |
| | | * @param type 设备类型 |
| | | * @return 已绑定返回true,未绑定返回false |
| | | * @return 属于该用户返回true,不是返回false |
| | | */ |
| | | public boolean isBelong(String deviceCode, String type) { |
| | | if (type.isEmpty() || deviceCode.isEmpty()) { |
| | | throw new BusinessException("设备编号或类型不能为空"); |
| | | } |
| | | Long userId = SecurityUtils.getClientId(); |
| | | Pole binding = baseMapper.getPoleByBinding(type, deviceCode, userId); |
| | | if (binding != null) { |