我想发送“ ASC ”或“ DESC ”查询的方向/顺序作为可分页对象的一部分。所以我的问题是,即使我将Direction设置为pageable的值,并且API URL Request中包含此信息,Spring后端也无法正确解析Pageble对象,并且始终将 ASC 显示为Direction (我认为这可能是默认状态)。
这是我在Angular控制器中的过滤方法
Controller.prototype.sortByDate = function(asc_desc,isStartDate){
this.pageable.sort = isStartDate ? "validityStartDate" : "validityEndDate";
this.pageable.direction = asc_desc;
this.service.findAll(this.filter,this.pageable).then(function(data){
this.magazineCollectionSubscriptionList = data.content;
this.setupPagination( data.totalElements );
this.changePageSize(size,this.filter);
}.bind(this));
}
这是我在此实体服务中的API调用
Service.prototype.findAll = function(filter,pageable){
return this.httpService.post(this.serviceUrl + '/list',filter,{ params: pageable });
};
这是它创建的请求
这是IDE上的调试显示