From 9946d271c3938db5a795739d65002d76409facec Mon Sep 17 00:00:00 2001 From: Agoni <1909624613@qq.com> Date: Wed, 23 Aug 2023 19:46:24 +0800 Subject: [PATCH] =?UTF-8?q?-=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QuotationSheetServiceImpl.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetServiceImpl.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetServiceImpl.java index 2e42bfa5..2744dda9 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetServiceImpl.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetServiceImpl.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.bs.service.quotationsheet; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; import cn.iocoder.yudao.module.bs.service.quotationsheetdetail.QuotationSheetDetailService; import cn.iocoder.yudao.module.bs.service.quotationsheetdetail.QuotationSheetDetailServiceImpl; @@ -41,13 +42,14 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl 0){ //中间表插入数据 - createReqVO.getQuotationDetails().forEach(quotationSheetDetail -> { - quotationSheetDetail.setCompanyId(quotationSheet.getId()); - }); + for (QuotationSheetDetailDO quotationSheetDetailDO : createReqVO.getQuotationDetails()) { + quotationSheetDetailDO.setCompanyId(quotationSheet.getId()); + } + quotationSheetDetailService.saveBatch(createReqVO.getQuotationDetails()); + } return quotationSheet.getId(); } @@ -57,20 +59,17 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl quotationSheetDetailDOList = - quotationSheetDetailService.list(Wrappers. lambdaQuery() - .eq(QuotationSheetDetailDO::getCompanyId,updateReqVO.getId()).eq(BaseDO::getDeleted,0)); - if (quotationSheetDetailDOList.size() > 0){ - quotationSheetDetailService.saveBatch(quotationSheetDetailDOList); - } + quotationSheetDetailService.remove(Wrappers. lambdaQuery() + .eq(QuotationSheetDetailDO::getCompanyId,updateReqVO.getId()).eq(BaseDO::getDeleted,0)); // 更新 QuotationSheetDO updateObj = QuotationSheetConvert.INSTANCE.convert(updateReqVO); - quotationSheetMapper.updateById(updateObj); + saveOrUpdate(updateObj); if (updateReqVO.getQuotationDetails().size() > 0){ //中间表插入数据 updateReqVO.getQuotationDetails().forEach(quotationSheetDetail -> { quotationSheetDetail.setCompanyId(updateObj.getId()); }); + quotationSheetDetailService.saveBatch(updateReqVO.getQuotationDetails()); } }