package com.uas.platform.b2b.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.uas.platform.b2b.model.SaleQuotationItem;

@Repository
public interface SaleQuotationItemDao extends JpaSpecificationExecutor<SaleQuotationItem>, JpaRepository<SaleQuotationItem, Long> {

	/**
	 * 按关联主动报价单ID和序号查找主动报价明细
	 * 
	 * @param quotationId
	 * @param number
	 * @return
	 */
	@Query("from SaleQuotationItem s where s.quotation.id= :quotationId and s.number= :number")
	List<SaleQuotationItem> findByQuotationIdAndNumber(@Param("quotationId") long quotationId, @Param("number") short number);

	/**
	 * 按卖家企业ID和采纳结果的传输状态查找主动报价明细
	 * 
	 * @param enUU
	 * @param decideStatus
	 * @return
	 */
	@Query("from SaleQuotationItem s where s.quotation.enUU = :enUU and s.decideStatus = :decideStatus")
	List<SaleQuotationItem> findByEnUUAndDecideStatus(@Param("enUU") long enUU, @Param("decideStatus") short decideStatus);

}
