Java 可分页属性大小值不生效
我有一个端点,在其他属性中,它需要一个可分页的 众所周知,pageable有三个属性(页面、大小、排序) 虽然前两个属性工作正常,我可以通过更改它们的值来操作返回的结果列表,但sort属性没有任何效果 这是我的疑问:Java 可分页属性大小值不生效,java,search,pagination,request,Java,Search,Pagination,Request,我有一个端点,在其他属性中,它需要一个可分页的 众所周知,pageable有三个属性(页面、大小、排序) 虽然前两个属性工作正常,我可以通过更改它们的值来操作返回的结果列表,但sort属性没有任何效果 这是我的疑问: http://localhost:8080/api/social/msg/?socialRef=general&fromDate=2020-07-29T22:00:00.000Z&toDate=2020-08-10T14:42:13.325Z&page=0&
http://localhost:8080/api/social/msg/?socialRef=general&fromDate=2020-07-29T22:00:00.000Z&toDate=2020-08-10T14:42:13.325Z&page=0&size=1000&sort=createdAt,desc
和端点代码:
public PaginatedCollection<SocialMsg> CustomCollectionListAll(Pageable pageable, Date lastModifiedBefore, Date lastModifiedAfter, String socialRef)
return socialService.messages().listAll(toPageableVO(pageable), lastModifiedBefore, lastModifiedAfter, socialRef);
public PaginatedCollection CustomCollectionListAll(可分页、日期lastModifiedBefore、日期lastModifiedBefore、字符串socialRef)
return socialService.messages().listAll(toPageableVO(pageable),lastModifiedBefore,lastModifiedAfter,socialRef);
确保createdAt
是Jpa使用的类的一个字段,并且它的类型实现了Compariable