Java 如何使用pageable参数定义请求中的方向?

Java 如何使用pageable参数定义请求中的方向?,java,api,kotlin,request,pageable,Java,Api,Kotlin,Request,Pageable,我有一个以pageable作为参数的查询。我将方向定义为DESC,但这不起作用。这是我的要求。你能不能帮我把这些请求按降序排序? 我已经在下面的图片中发布了我的请求。它可以工作,但不能对结果进行排序 多谢各位 这是控制器代码: @GetMapping fun listMessages(@RequestParam conversationRef: String, @RequestParam fromDate: Instant, @RequestParam toD

我有一个以pageable作为参数的查询。我将方向定义为DESC,但这不起作用。这是我的要求。你能不能帮我把这些请求按降序排序? 我已经在下面的图片中发布了我的请求。它可以工作,但不能对结果进行排序

多谢各位

这是控制器代码:

@GetMapping
fun listMessages(@RequestParam conversationRef: String,
                 @RequestParam fromDate: Instant, @RequestParam toDate: Instant, 
                 pageable: Pageable): PaginatedCollection<MessageVO> {
                     return messageService.listAll(fromDate, toDate, pageable, 
                              conversationRef).data ?: PaginatedCollection(listOf(), 
                              PaginationVO.build(), SortVO.build())
}
@GetMapping
趣味listMessages(@RequestParam conversationRef:String,
@RequestParam fromDate:Instant、@RequestParam toDate:Instant、,
可分页:可分页):分页集合{
return messageService.listAll(fromDate、toDate、pageable、,
conversationRef).数据?:分页的集合(listOf(),
分页vo.build(),SortVO.build())
}

您需要发送要按降序排序的排序字段。()例如:

http://localhost:8080/people?sort=id,desc

这里,
id
是排序字段,
desc
是排序方向,用逗号分隔


因此,您需要在邮递员中发送
id,desc
on
sort
param,以便按发货顺序按
id
排序。

请显示您的代码您是对的。Updated分页表中的排序字段是一个至少包含两个值的类。排序的方向和要排序的字段。读是的。我知道。请求的格式是我没有想到的,比如在邮递员请求的上下文中如何添加要排序的字段?