Spring boot JPA 多重排序

第一种方式:

 Sort sort = new Sort(Sort.Direction.DESC, "preDrawIssue").and(new Sort(Sort.Direction.ASC, "regionCode"));

 Pageable pageable = PageRequest.of(pageNo - 1, pageSize, sort);

第二种方式:

       List orders=new ArrayList<>();
         orders.add(new Sort.Order(Sort.Direction.DESC,"preDrawIssue"));
         orders.add(new Sort.Order(Sort.Direction.ASC,"regionCode"));

          Sort sort  = Sort.by(orders);

    Pageable pageable = PageRequest.of(pageNo - 1, pageSize, sort);

你可能感兴趣的:(spring,boot)