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.SaleARCheckReply;

@Repository
public interface SaleARCheckReplyDao extends JpaSpecificationExecutor<SaleARCheckReply>, JpaRepository<SaleARCheckReply, Long> {

	/**
	 * 按对账单明细ID查找对账单明细的回复
	 * 
	 * @param orderItemId
	 * @return
	 */
	@Query("from SaleARCheckReply r where r.itemId = :itemId order by r.date asc")
	public List<SaleARCheckReply> findByItemId(@Param("itemId") Long itemId);

	/**
	 * (卖家)按回复记录的状态查找回复记录
	 * 
	 * @param vendUU
	 * @param sendStatus
	 * @return
	 */
	@Query("from SaleARCheckReply r where r.item.arCheck.vendUU = :vendUU and r.sendStatus = :sendStatus")
	public List<SaleARCheckReply> findByVendUUAndStatus(@Param("vendUU") Long vendUU, @Param("sendStatus") Short sendStatus);
}
