Commit 74942720 by gdj

增加机场,无人机增删改功能3。

parent 79ffc8d8
......@@ -240,4 +240,17 @@ public class DeviceController {
return HttpResultResponse.success();
}
/**
* Removing the device.
* @param workspaceId
* @param id
* @return
*/
@DeleteMapping("/{workspace_id}/deleteById")
public HttpResultResponse deleteDeviceById(@PathVariable("workspace_id") String workspaceId,
@RequestParam(name = "id") Integer id) {
deviceService.deleteDeviceById(workspaceId, id);
return HttpResultResponse.success();
}
}
\ No newline at end of file
......@@ -166,6 +166,15 @@ public interface IDeviceService {
boolean deleteDevice(String deviceSn);
/**
* delete device base on device's id
* @param workspaceId
* @param id
* @return
*/
boolean deleteDeviceById(String workspaceId, Integer id);
/**
* Get device information based on device's sn.
* @param sn device's sn
* @return device
......
......@@ -564,6 +564,16 @@ public class DeviceServiceImpl implements IDeviceService {
}
@Override
public boolean deleteDeviceById(String workspaceId, Integer id) {
LambdaQueryWrapper<DeviceEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DeviceEntity::getWorkspaceId, workspaceId);
queryWrapper.eq(DeviceEntity::getId, id);
int delete = this.mapper.delete(queryWrapper);
return delete > 0;
}
@Override
public Optional<DeviceDTO> getDeviceBySn(String sn) {
List<DeviceDTO> devicesList = this.getDevicesByParams(DeviceQueryParam.builder().deviceSn(sn).build());
if (devicesList.isEmpty()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment