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

main
ck-chenkang 3 weeks ago
parent 7b17c21c71
commit c9c5035f75

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

Loading…
Cancel
Save