package app.repositories; import app.entities.db.DbFile; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; import java.util.UUID; public interface FilePSRepository extends PagingAndSortingRepository { @Query("select f from DbFile f where (f.deleted = false or f.deleted is null) and " + "(:steam64_non_exists = true or position(f.uploader in :steam64_ids) > 0) and " + "(:begin_date_null is null or DATE_PART('EPOCH', f.timestamp) >= :begin_date) and " + "(:end_date_null is null or :end_date >= DATE_PART('EPOCH', f.timestamp)) " + "order by f.timestamp desc") Page getFiles(Pageable pageable, @Param(value = "steam64_non_exists") Boolean steam64_non_exists, @Param(value = "steam64_ids") String steam64_ids, @Param(value = "begin_date") Long begin_date, @Param(value = "end_date") Long end_date, @Param(value = "begin_date_null") Long begin_date_null, @Param(value = "end_date_null") Long end_date_null); }