| | |
| | | import cn.iocoder.yudao.module.crm.enums.quotation.CrmSaleQuotationStatusEnum; |
| | | import cn.iocoder.yudao.module.crm.util.CrmPermissionUtils; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * CRM 销售报价单 Mapper |
| | | * |
| | | * @author 芋道源码 |
| | | * @author 超级管理员 |
| | | */ |
| | | @Mapper |
| | | public interface CrmSaleQuotationMapper extends BaseMapperX<CrmSaleQuotationDO> { |
| | |
| | | default CrmSaleQuotationDO selectByNo(String no) { |
| | | return selectOne(CrmSaleQuotationDO::getNo, no); |
| | | } |
| | | |
| | | /** |
| | | * 按报价单号查询记录(不过滤逻辑删除,含已删除行) |
| | | * 用于自定义单号的唯一性预校验:uk_no 唯一索引覆盖已删除行,需一起判断才能给出可读提示 |
| | | */ |
| | | @Select("SELECT * FROM crm_sale_quotation WHERE no = #{no} LIMIT 1") |
| | | CrmSaleQuotationDO selectAnyByNo(String no); |
| | | |
| | | default PageResult<CrmSaleQuotationDO> selectPage(CrmSaleQuotationPageReqVO pageReqVO, Long userId) { |
| | | return selectPage(pageReqVO, userId, null); |
| | |
| | | .eqIfPresent(CrmSaleQuotationDO::getCustomerId, pageReqVO.getCustomerId()) |
| | | .eqIfPresent(CrmSaleQuotationDO::getBusinessId, pageReqVO.getBusinessId()) |
| | | .eqIfPresent(CrmSaleQuotationDO::getStatus, pageReqVO.getStatus()) |
| | | .likeIfPresent(CrmSaleQuotationDO::getBidBondNo, pageReqVO.getBidBondNo()) |
| | | .orderByDesc(CrmSaleQuotationDO::getId); |
| | | |
| | | // 客户权限过滤 |
| | |
| | | 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); |
| | | } |
| | |
| | | .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)); |
| | | } |
| | | |
| | | } |