0

我想作为 Pageable 对象的一部分发送查询“ ASC ”或“ DESC ”的方向/顺序。所以我的问题是,即使我将方向设置为 pageable 的值并且 API URL 请求中包含此信息,Spring 后端也无法正确解析 Pageble 对象并且它始终将ASC显示为方向(我认为这可能是默认状态)。

这是我在 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 上的调试显示

在此处输入图像描述

4

0 回答 0