|
|
|
|
@ -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);
|
|
|
|
|
// 设备台账关联产线
|
|
|
|
|
|