package com.fd.repository; import com.fd.entity.FileEntity; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Query; import java.util.List; /** * Created by Owen on 2019/10/28 0028 11:36 * * JpaSpecificationExecutor 条件分页查询 */ public interface FileRepository extends JpaRepository, JpaSpecificationExecutor { // 条件分页查询 Page findByType(String type, Pageable pageable); @Query(value = "select r from FileEntity r where r.type=?1 or r.type =?2") Page findByType(String type, String type1, Pageable pageable); List findByFileName(String fileName); List findByFileNameAndType(String fileName, String type); List findByDirectory(String directory); }