package com.uas.platform.b2b.dao;

import com.uas.platform.b2b.model.VendorPerformanceAssess;
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 java.util.List;

/**
 * Created by 黄诚天 on 2017-10-12.
 */
@Repository
public interface VendorPerformanceAssessDao extends JpaSpecificationExecutor<VendorPerformanceAssess>, JpaRepository<VendorPerformanceAssess, Long> {

    @Query("from VendorPerformanceAssess v where v.enUU = :enUU and v.vpaId = :vpaId")
    public List<VendorPerformanceAssess> findByEnUUAndVapId(@Param("enUU") long enUU, @Param("vpaId") Long vpaId);

    @Query("select count(p) from VendorPerformanceAssess p where p.id in :ids")
    List<Object[]> getUnreadCountEveryStatus(List<Long> ids);
}
