云
5 天以前 a82d847bbb39e2417d4c9773ebc4fc51fdb0b8fc
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/quotation/CrmSaleQuotationMapper.java
@@ -15,6 +15,7 @@
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.Collection;
import java.util.List;
/**
@@ -59,6 +60,7 @@
                .eqIfPresent(CrmSaleQuotationDO::getCustomerId, pageReqVO.getCustomerId())
                .eqIfPresent(CrmSaleQuotationDO::getBusinessId, pageReqVO.getBusinessId())
                .eqIfPresent(CrmSaleQuotationDO::getStatus, pageReqVO.getStatus())
                .likeIfPresent(CrmSaleQuotationDO::getBidBondNo, pageReqVO.getBidBondNo())
                .orderByDesc(CrmSaleQuotationDO::getId);
        // 客户权限过滤
@@ -92,6 +94,14 @@
        return selectList(CrmSaleQuotationDO::getCustomerId, customerId);
    }
    default List<CrmSaleQuotationDO> selectListByCustomerIdAndStatuses(Long customerId,
                                                                      Collection<Integer> statuses) {
        return selectList(new LambdaQueryWrapperX<CrmSaleQuotationDO>()
                .eq(CrmSaleQuotationDO::getCustomerId, customerId)
                .in(CrmSaleQuotationDO::getStatus, statuses)
                .orderByDesc(CrmSaleQuotationDO::getId));
    }
    default List<CrmSaleQuotationDO> selectListByBusinessId(Long businessId) {
        return selectList(CrmSaleQuotationDO::getBusinessId, businessId);
    }
@@ -117,4 +127,24 @@
                .set(CrmSaleQuotationDO::getContractNo, null));
    }
    /**
     * 绑定投标;bidBondId 为 null 时表示解绑
     */
    default void bindBidBond(Long quotationId, Long bidBondId, String bidBondNo) {
        update(new LambdaUpdateWrapper<CrmSaleQuotationDO>()
                .eq(CrmSaleQuotationDO::getId, quotationId)
                .set(CrmSaleQuotationDO::getBidBondId, bidBondId)
                .set(CrmSaleQuotationDO::getBidBondNo, bidBondNo));
    }
    /**
     * 重新报价:重置为草稿并清空流程实例
     */
    default void resetToDraft(Long quotationId) {
        update(new LambdaUpdateWrapper<CrmSaleQuotationDO>()
                .eq(CrmSaleQuotationDO::getId, quotationId)
                .set(CrmSaleQuotationDO::getStatus, CrmSaleQuotationStatusEnum.DRAFT.getStatus())
                .set(CrmSaleQuotationDO::getProcessInstanceId, null));
    }
}