package com.ann.demo.repository;

import com.ann.demo.entity.filing.ArchiveDetail;
import com.ann.demo.entity.interfaceEntity.ArchiveMaster;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: LeiJiaXin
 * @Date: 2019/7/12 9:10
 */
@Repository
public interface ArchiveDetailRepository extends JpaRepository<ArchiveDetail, String> {

    @Query("select count (o) from ArchiveDetail  o where o.masterID = ?1 and o.assortID = ?2  and o.source=?3 and (o.applyId = ?4 and o.applyId is not null) ")
    Integer countByMasterIDAndAssortIDAndSourceAndApplyId(String masterId, String AssortID, String source, String applyId);

    public ArchiveDetail findByMasterIDAndAssortIDAndSourceAndApplyId(String masterId, String AssortID, String source, String applyId);

//    public ArchiveMaster findByInpNoAndVisitIdAndIsValid(String inpNo, String visitId, Integer valid);
}
