yaowanxin
6 小时以前 18c919819ba263a03783afa38d1294436584c842
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -82,6 +82,7 @@
    private final InvoiceLedgerMapper invoiceLedgerMapper;
    private final SalesLedgerSchedulingMapper salesLedgerSchedulingMapper;
    private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
    @Autowired
    private SysDeptMapper sysDeptMapper;
@@ -361,6 +362,15 @@
        LambdaQueryWrapper<SalesLedgerScheduling> in = new LambdaQueryWrapper<SalesLedgerScheduling>()
                .in(SalesLedgerScheduling::getSalesLedgerId, idList);
        salesLedgerSchedulingMapper.delete(in);
        LambdaQueryWrapper<InvoiceRegistrationProduct> InvoiceRegistrationProductWrapper = new LambdaQueryWrapper<>();
        InvoiceRegistrationProductWrapper.in(InvoiceRegistrationProduct::getSalesLedgerId, idList);
        List<InvoiceRegistrationProduct> invoiceRegistrationProducts = invoiceRegistrationProductMapper.selectList(InvoiceRegistrationProductWrapper);
        if (!CollectionUtils.isEmpty(invoiceRegistrationProducts)) {
            List<Integer> InvoiceRegistrationProductIds = invoiceRegistrationProducts.stream().map(InvoiceRegistrationProduct::getId).collect(Collectors.toList());
            LambdaQueryWrapper<InvoiceLedger> invoiceLedgerQuery = new LambdaQueryWrapper<>();
            invoiceLedgerQuery.in(InvoiceLedger::getInvoiceRegistrationProductId, InvoiceRegistrationProductIds);
            invoiceLedgerMapper.delete(invoiceLedgerQuery);
        }
        // 2. 再删除主表数据
        return salesLedgerMapper.deleteBatchIds(idList);
    }