diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java index d422650b..b5f3aece 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java @@ -1,5 +1,8 @@ package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo; +import cn.iocoder.yudao.module.bs.controller.admin.quotationsheetdetail.vo.QuotationSheetDetailBaseVO; +import cn.iocoder.yudao.module.bs.controller.admin.quotationsheetdetail.vo.QuotationSheetDetailCreateReqVO; +import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; import lombok.*; import java.util.*; import io.swagger.v3.oas.annotations.media.Schema; @@ -10,7 +13,10 @@ import javax.validation.constraints.*; @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class QuotationSheetCreateReqVO extends QuotationSheetBaseVO { - @Schema(description = "物料id集合", requiredMode = Schema.RequiredMode.REQUIRED) + /* @Schema(description = "物料id集合", requiredMode = Schema.RequiredMode.REQUIRED) @NotEmpty(message = "物料id集合不能为空") - private List suppliesIdList; + private List suppliesIdList;*/ + + @NotEmpty(message = "物料不能为空") + private List quotationDetails; } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetRespVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetRespVO.java index 825bc375..34038a8e 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetRespVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetRespVO.java @@ -1,8 +1,11 @@ package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo; +import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO; +import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.time.LocalDateTime; +import java.util.List; @Schema(description = "管理后台 - 报价单 Response VO") @Data @@ -16,4 +19,7 @@ public class QuotationSheetRespVO extends QuotationSheetBaseVO { @Schema(description = "创建时间") private LocalDateTime createTime; + + private List quotationDetails; + } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetUpdateReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetUpdateReqVO.java index 5ac69c27..63e8b6b6 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetUpdateReqVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetUpdateReqVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo; +import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; @@ -15,4 +16,8 @@ public class QuotationSheetUpdateReqVO extends QuotationSheetBaseVO { @NotNull(message = "主键不能为空") private Long id; + + @NotEmpty(message = "物料不能为空") + private List quotationDetails; + } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/materiel/MaterielDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/materiel/MaterielDO.java index 1bce4c2c..c237de37 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/materiel/MaterielDO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/materiel/MaterielDO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.bs.dal.dataobject.materiel; +import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import lombok.*; import java.util.*; import java.time.LocalDateTime; @@ -20,7 +21,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; @Builder @NoArgsConstructor @AllArgsConstructor -public class MaterielDO extends BaseDO { +public class MaterielDO extends TenantBaseDO { /** * 主键 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 b84b1fb6..2e42bfa5 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,5 +1,10 @@ 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.quotationsheetdetail.QuotationSheetDetailDO; +import cn.iocoder.yudao.module.bs.service.quotationsheetdetail.QuotationSheetDetailService; +import cn.iocoder.yudao.module.bs.service.quotationsheetdetail.QuotationSheetDetailServiceImpl; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.yulichang.base.MPJBaseServiceImpl; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import org.springframework.stereotype.Service; @@ -29,16 +34,21 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl 0){ + //中间表插入数据 + createReqVO.getQuotationDetails().forEach(quotationSheetDetail -> { + quotationSheetDetail.setCompanyId(quotationSheet.getId()); + }); + } return quotationSheet.getId(); } @@ -46,9 +56,22 @@ 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); + } // 更新 QuotationSheetDO updateObj = QuotationSheetConvert.INSTANCE.convert(updateReqVO); quotationSheetMapper.updateById(updateObj); + if (updateReqVO.getQuotationDetails().size() > 0){ + //中间表插入数据 + updateReqVO.getQuotationDetails().forEach(quotationSheetDetail -> { + quotationSheetDetail.setCompanyId(updateObj.getId()); + }); + } } @Override diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheetdetail/QuotationSheetDetailService.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheetdetail/QuotationSheetDetailService.java index 6a03eb31..8979199d 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheetdetail/QuotationSheetDetailService.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheetdetail/QuotationSheetDetailService.java @@ -3,15 +3,17 @@ package cn.iocoder.yudao.module.bs.service.quotationsheetdetail; import java.util.*; import javax.validation.*; import cn.iocoder.yudao.module.bs.controller.admin.quotationsheetdetail.vo.*; +import cn.iocoder.yudao.module.bs.dal.dataobject.materiel.MaterielDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import com.github.yulichang.base.MPJBaseService; /** * 报价单物料明细 Service 接口 * * @author 芋道源码 */ -public interface QuotationSheetDetailService { +public interface QuotationSheetDetailService extends MPJBaseService { /** * 创建报价单物料明细 diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheetdetail/QuotationSheetDetailServiceImpl.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheetdetail/QuotationSheetDetailServiceImpl.java index 89cf2431..af106dbd 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheetdetail/QuotationSheetDetailServiceImpl.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheetdetail/QuotationSheetDetailServiceImpl.java @@ -1,5 +1,8 @@ package cn.iocoder.yudao.module.bs.service.quotationsheetdetail; +import cn.iocoder.yudao.module.bs.dal.dataobject.materiel.MaterielDO; +import cn.iocoder.yudao.module.bs.dal.mysql.materiel.MaterielMapper; +import com.github.yulichang.base.MPJBaseServiceImpl; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -22,7 +25,7 @@ import static cn.iocoder.yudao.module.bs.enums.ErrorCodeConstants.*; */ @Service @Validated -public class QuotationSheetDetailServiceImpl implements QuotationSheetDetailService { +public class QuotationSheetDetailServiceImpl extends MPJBaseServiceImpl implements QuotationSheetDetailService { @Resource private QuotationSheetDetailMapper quotationSheetDetailMapper;