Compare commits

..

No commits in common. "3485614a84b476e8e174b857335e5423527883d4" and "4cba5029c620d5d5b587edd4096ad871f3898a6c" have entirely different histories.

2 changed files with 4 additions and 12 deletions

View File

@ -53,10 +53,10 @@ public class DeviceController {
@PreAuthorize("hasRole('DEVICE_ADMIN')")
@PostMapping("/{userId}")
public ResponseResult<DeviceAdminVO> addDevice(@PathVariable("userId") Long userId,
public ResponseResult<Device> addDevice(@PathVariable("userId") Long userId,
@RequestBody Device device) {
deviceService.addDevice(userId, device);
return ResponseResult.success(new DeviceAdminVO(device));
return ResponseResult.success(device);
}
@PreAuthorize("hasRole('DEVICE_ADMIN')")
@ -68,11 +68,11 @@ public class DeviceController {
@PreAuthorize("hasRole('DEVICE_ADMIN')")
@PutMapping("/{id}")
public ResponseResult<DeviceAdminVO> updateDevice(@PathVariable("id") Long id,
public ResponseResult<?> updateDevice(@PathVariable("id") Long id,
@RequestBody Device device) {
device.setId(id);
Device updatedDevice = deviceService.updateDevice(device);
return ResponseResult.success(new DeviceAdminVO(updatedDevice));
return ResponseResult.success(updatedDevice);
}
@PreAuthorize("hasRole('DEVICE_ADMIN')")

View File

@ -80,14 +80,6 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public void deleteDevice(Long id) {
Device device = deviceMapper.selectById(id);
if (StringUtils.hasText(device.getImagePath())) {
Path fullPath = Paths.get(System.getProperty("user.dir"), device.getImagePath()).normalize();
File file = fullPath.toFile();
if (file.exists() && file.isFile()) {
file.delete();
}
}
deviceMapper.delete(new LambdaQueryWrapper<Device>()
.eq(Device::getId, id));
}