| | |
| | | public Result<Void> addDeviceToGroup( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | | deviceGroupRelationService.addDeviceToGroup(request.getGroupId(), request.getDeviceId(), |
| | | deviceGroupRelationService.addDeviceToGroup(request.getGroupId(), request.getId(), |
| | | request.getDeviceRole() != null ? request.getDeviceRole() : "MEMBER"); |
| | | return Result.success(null); |
| | | } catch (Exception e) { |
| | |
| | | public Result<Void> removeDeviceFromGroup( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | | deviceGroupRelationService.removeDeviceFromGroup(request.getGroupId(), request.getDeviceId()); |
| | | deviceGroupRelationService.removeDeviceFromGroup(request.getGroupId(), request.getId()); |
| | | return Result.success(null); |
| | | } catch (Exception e) { |
| | | log.error("从设备组移除设备失败", e); |
| | |
| | | public Result<Void> updateDeviceRole( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | | deviceGroupRelationService.updateDeviceRole(request.getGroupId(), request.getDeviceId(), |
| | | deviceGroupRelationService.updateDeviceRole(request.getGroupId(), request.getId(), |
| | | request.getDeviceRole()); |
| | | return Result.success(null); |
| | | } catch (Exception e) { |
| | |
| | | public Result<List<DeviceGroupVO.GroupInfo>> getDeviceGroups( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | | List<DeviceGroupVO.GroupInfo> groups = deviceGroupRelationService.getDeviceGroups(request.getDeviceId()); |
| | | List<DeviceGroupVO.GroupInfo> groups = deviceGroupRelationService.getDeviceGroups(request.getId()); |
| | | return Result.success(groups); |
| | | } catch (Exception e) { |
| | | log.error("获取设备设备组列表失败", e); |