package com.uas.platform.b2b.dao;

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

@Repository
public interface PurchaseReturnItemDao extends JpaSpecificationExecutor<PurchaseReturnItem>,
		JpaRepository<PurchaseReturnItem, Long> {

    /**
     *  根据企业UU，采购验退单号，序号，查询采购验退单明细
     * @param enUU
     * @param code
     * @param number
     * @return
     */
    @Query("from PurchaseReturnItem r where r.purchaseReturn.enUU = :enUU and r.purchaseReturn.code = :code and r.number = :number")
    PurchaseReturnItem findByEnUUAndCodeAndNumber(@Param("enUU") Long enUU, @Param("code") String code, @Param("number") Short number);
}
