diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/xzd/service/impl/XzdCorrespondentListImp.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/xzd/service/impl/XzdCorrespondentListImp.java index 04ca0a5b..a7792484 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/xzd/service/impl/XzdCorrespondentListImp.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/xzd/service/impl/XzdCorrespondentListImp.java @@ -309,6 +309,7 @@ public class XzdCorrespondentListImp implements IXzdCorrespondentList { } @Override + @Transactional(rollbackFor = Exception.class) public R delCorrespondent(Long[] dto) { for (int i = dto.length - 1; i >= 0; i--) { @@ -571,8 +572,9 @@ public class XzdCorrespondentListImp implements IXzdCorrespondentList { public void delCorrespondentVoid(Long dto){ // 删除中间表 - XzdCustomerSupplierYyb xzdCustomerSupplierYyb = iXzdCustomerSupplierYybService.getBaseMapper().selectOne(new LambdaQueryWrapper().eq(XzdCustomerSupplierYyb::getCSId, dto)); - if (xzdCustomerSupplierYyb == null) { + List xzdCustomerSupplierYyb = iXzdCustomerSupplierYybService.getBaseMapper().selectList(new LambdaQueryWrapper().eq(XzdCustomerSupplierYyb::getCSId, dto)); + + if (xzdCustomerSupplierYyb == null || xzdCustomerSupplierYyb.size() == 0) { iXzdCustomerSupplierService.getBaseMapper().delete(new LambdaQueryWrapper().eq(XzdCustomerSupplier::getCSId, dto)); }else { throw new RuntimeException("该客户信息已被使用,无法删除");