• [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);
    }
  • 相关阅读:
    Node Express4.x 片段视图 partials
    SVG知识难点
    MongoDB的安装和配置成服务的三种方法和一些难点
    git的使用
    单击获取索引的两种方式
    IOTA初识
    开始写博客啦
    虚拟化技术
    可信计算概论
    负载均衡
  • 原文地址:https://www.cnblogs.com/Answer1215/p/14131342.html
Copyright © 2020-2023  润新知