feat:处理device id为null,不给删除的情况

main
ck-chenkang 1 day ago
parent 7b17c21c71
commit c9c5035f75

@ -140,11 +140,16 @@ public class OrganizationServiceImpl implements OrganizationService {
if (organizationMapper.selectCountByParentId(id) > 0) {
throw exception(ORGANIZATION_EXITS_CHILDREN);
}
DeviceLedgerDO deviceLedgerDO = deviceLedgerService.getDeviceLedger(organizationMapper.selectById(id).getMachineId());
if (deviceLedgerDO != null) {
deviceLedgerDO.setWorkshop(null);
deviceLedgerService.updateDeviceLedger(BeanUtils.toBean(deviceLedgerDO, DeviceLedgerSaveReqVO.class));
Long deviceId = organizationMapper.selectById(id).getMachineId();
if(deviceId != null){ // 处理device id为null不给删除的情况
DeviceLedgerDO deviceLedgerDO = deviceLedgerService.getDeviceLedger(deviceId);
if (deviceLedgerDO != null) {
deviceLedgerDO.setWorkshop(null);
deviceLedgerService.updateDeviceLedger(BeanUtils.toBean(deviceLedgerDO, DeviceLedgerSaveReqVO.class));
}
}
// 删除
organizationMapper.deleteById(id);
// 设备台账关联产线

Loading…
Cancel
Save