package com.uas.platform.b2b.dao;

import java.util.List;

import org.apache.log4j.lf5.viewer.configure.MRUFileManager;
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.PurchaseProofingItem;

@Repository
public interface PurchaseProofingItemDao extends JpaSpecificationExecutor<PurchaseProofingItem>, JpaRepository<PurchaseProofingItem, Long> {

	/**
	 * 按卖家企业ID和明细传到卖家ERP状态查找客户打样申请明细
	 * 
	 * @param vendUU
	 * @param sendStatus
	 * @return
	 */
	List<PurchaseProofingItem> findByVendUUAndSendStatus(long vendUU, short sendStatus);
	
	/**
	 * 获得每种单据状态的未读数量
	 *
	 * @Param ids 未读单据id
	 * @return
	 */
	@Query("select count(p), p.status from PurchaseProofingItem p where p.id in :ids group by p.status")
	List<Object[]> getUnreadCountEveryStatus(@Param("ids") List<Long> ids);

}
