|
@@ -87,6 +87,7 @@ public class IotDeviceService {
|
|
|
iotDevice.setEnableFlag(1);
|
|
iotDevice.setEnableFlag(1);
|
|
|
iotDevice.setRemark(iotDevicePara.getRemark());
|
|
iotDevice.setRemark(iotDevicePara.getRemark());
|
|
|
iotDeviceMapper.insert(iotDevice);
|
|
iotDeviceMapper.insert(iotDevice);
|
|
|
|
|
+ iotProductMapper.updateSize(iotDevicePara.getProductId(), 1);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -96,11 +97,17 @@ public class IotDeviceService {
|
|
|
* @param id
|
|
* @param id
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public Object remove(Long id) {
|
|
public Object remove(Long id) {
|
|
|
|
|
+ IotDevice iotDevice1 = iotDeviceMapper.selectById(id);
|
|
|
|
|
+ if (Objects.isNull(iotDevice1)) {
|
|
|
|
|
+ throw new BusinessException("设备不存在");
|
|
|
|
|
+ }
|
|
|
IotDevice iotDevice = new IotDevice();
|
|
IotDevice iotDevice = new IotDevice();
|
|
|
iotDevice.setDeleteTime(LocalDateTime.now());
|
|
iotDevice.setDeleteTime(LocalDateTime.now());
|
|
|
iotDevice.setDelFlag(Global.DEL);
|
|
iotDevice.setDelFlag(Global.DEL);
|
|
|
iotDeviceMapper.update(iotDevice, new LambdaQueryWrapper<IotDevice>().eq(IotDevice::getId, id).eq(IotDevice::getDelFlag, Global.UN_DEL));
|
|
iotDeviceMapper.update(iotDevice, new LambdaQueryWrapper<IotDevice>().eq(IotDevice::getId, id).eq(IotDevice::getDelFlag, Global.UN_DEL));
|
|
|
|
|
+ iotProductMapper.updateSize(iotDevice1.getProductId(), -1);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -207,6 +214,7 @@ public class IotDeviceService {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询设备信息
|
|
* 查询设备信息
|
|
|
|
|
+ *
|
|
|
* @param guid
|
|
* @param guid
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|