[Java Spring] Built-in page and sorting

package com.example.ec.repo;

import com.example.ec.domain.Difficulty;
import com.example.ec.domain.Region;
import com.example.ec.domain.Tour;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import java.util.*;


public interface TourRepository extends PagingAndSortingRepository<Tour, Integer> {

    // without paging
    // /tours/search/findByTourPackageCode?code=CC
    List<Tour> findByTourPackageCode(@Param("code") String codee);

    // with paging and sorting
    // /tours/search/findByTourPackageCode?code=CC&size=3&sort=title,asc
    Page<Tour> findByTourPackageCode(@Param("code") String code, Pageable pageable);
}

 

上一篇:Cuber Sorting


下一篇:使用python排序beautifulsoup标签的列表