fix:优化应用接口移除设备

V0.5.x
tangfudong 2024-03-19 18:40:57 +08:00
parent 7a27435705
commit de49f494c0
1 changed files with 4 additions and 4 deletions

View File

@ -304,15 +304,15 @@ public class SpaceDeviceController {
/** /**
* *
*/ */
@DeleteMapping(Constants.API_SPACE.REMOVE_DEVICE) @PostMapping(Constants.API_SPACE.REMOVE_DEVICE)
public void removeDevice(String deviceId) { public void removeDevice(@RequestBody @Validated Request<String> request) {
SpaceDevice spaceDevice = spaceDeviceService.findByDeviceId(deviceId); SpaceDevice spaceDevice = spaceDeviceService.findByDeviceId(request.getData());
if (spaceDevice == null) { if (spaceDevice == null) {
throw new BizException(ErrCode.SPACE_DEVICE_NOT_FOUND); throw new BizException(ErrCode.SPACE_DEVICE_NOT_FOUND);
} }
spaceDeviceService.deleteById(spaceDevice.getId()); spaceDeviceService.deleteById(spaceDevice.getId());
DeviceInfo deviceInfo = deviceInfoData.findByDeviceId(deviceId); DeviceInfo deviceInfo = deviceInfoData.findByDeviceId(request.getData());
UserInfo userInfo = userInfoData.findById(LoginHelper.getUserId()); UserInfo userInfo = userInfoData.findById(LoginHelper.getUserId());
if (userInfo == null) { if (userInfo == null) {
throw new BizException(ErrCode.USER_NOT_FOUND); throw new BizException(ErrCode.USER_NOT_FOUND);