This commit is contained in:
磷叶 2025-04-19 19:38:59 +08:00
parent bef43caee5
commit 3b2bfd50d5

View File

@ -35,10 +35,10 @@ public class DeviceIotController extends BaseController {
private DeviceVO getDevice(Long id, String sn) { private DeviceVO getDevice(Long id, String sn) {
if (id != null) { if (id != null) {
ServiceUtil.assertion(deviceValidator.canOperate(id), "您无权限操作ID为%s的设备", id); ServiceUtil.assertion(!deviceValidator.canOperate(id), "您无权限操作ID为%s的设备", id);
return deviceService.selectDeviceById(id, true); return deviceService.selectDeviceById(id, true);
} else if (sn != null) { } else if (sn != null) {
ServiceUtil.assertion(deviceValidator.canOperate(sn), "您无权限操作SN为%s的设备", sn); ServiceUtil.assertion(!deviceValidator.canOperate(sn), "您无权限操作SN为%s的设备", sn);
return deviceService.selectDeviceBySn(sn, true); return deviceService.selectDeviceBySn(sn, true);
} else { } else {
throw new ServiceException("SN和ID不能同时为空"); throw new ServiceException("SN和ID不能同时为空");