Java 使用QueryDSL和分页的Spring引导:嵌套数组元素上的页面排序不起作用
我使用Spring Boot QueryDSL过滤实体和Spring Boot Page功能进行分页和排序,以便调用以下方法:Java 使用QueryDSL和分页的Spring引导:嵌套数组元素上的页面排序不起作用,java,spring,sorting,pagination,querydsl,Java,Spring,Sorting,Pagination,Querydsl,我使用Spring Boot QueryDSL过滤实体和Spring Boot Page功能进行分页和排序,以便调用以下方法: Page<Country> all=countryRepository.findAll(predicate,pageable); 我得到以下结果: [ { "id": "DE", "currency": "EUR", "preSelection": 49,
Page<Country> all=countryRepository.findAll(predicate,pageable);
我得到以下结果:
[
{
"id": "DE",
"currency": "EUR",
"preSelection": 49,
"currencySign": "€",
"translations": [
{
"id": "11",
"name": "Deutschland",
"text": null,
"languageId": "de"
},
{
"id": "322",
"name": "Allemagne",
"text": null,
"languageId": "fr"
},
{
"id": "18",
"name": "Germany",
"text": null,
"languageId": "en"
}
]
},
{
"id": "ES",
"currency": "EUR",
"preSelection": 34,
"currencySign": "€",
"translations": [
{
"id": "16",
"name": "Spanien",
"text": null,
"languageId": "de"
},
{
"id": "23",
"name": "Spain",
"text": null,
"languageId": "en"
}
]
},
{
"id": "PT",
"currency": "EUR",
"preSelection": 351,
"currencySign": "€",
"translations": [
{
"id": "24",
"name": "Portugal",
"text": null,
"languageId": "en"
},
{
"id": "17",
"name": "Portugal",
"text": null,
"languageId": "de"
}
]
}
]
好的,那就行了!
但现在我想根据收集的翻译对象,根据它们的德语名称,对我的国家对象进行排序:
http://localhost:8090/countries?translations.languages.id=de&sort=translations.name
结果是:
[
{
"id": "DE",
"currency": "EUR",
"preSelection": 49,
"currencySign": "€",
"translations": [
{
"id": "11",
"name": "Deutschland",
"text": null,
"languageId": "de"
},
{
"id": "322",
"name": "Allemagne",
"text": null,
"languageId": "fr"
},
{
"id": "18",
"name": "Germany",
"text": null,
"languageId": "en"
}
]
},
{
"id": "DE",
"currency": "EUR",
"preSelection": 49,
"currencySign": "€",
"translations": [
{
"id": "11",
"name": "Deutschland",
"text": null,
"languageId": "de"
},
{
"id": "322",
"name": "Allemagne",
"text": null,
"languageId": "fr"
},
{
"id": "18",
"name": "Germany",
"text": null,
"languageId": "en"
}
]
},
{
"id": "DE",
"currency": "EUR",
"preSelection": 49,
"currencySign": "€",
"translations": [
{
"id": "11",
"name": "Deutschland",
"text": null,
"languageId": "de"
},
{
"id": "322",
"name": "Allemagne",
"text": null,
"languageId": "fr"
},
{
"id": "18",
"name": "Germany",
"text": null,
"languageId": "en"
}
]
},
{
"id": "PT",
"currency": "EUR",
"preSelection": 351,
"currencySign": "€",
"translations": [
{
"id": "24",
"name": "Portugal",
"text": null,
"languageId": "en"
},
{
"id": "17",
"name": "Portugal",
"text": null,
"languageId": "de"
}
]
},
{
"id": "PT",
"currency": "EUR",
"preSelection": 351,
"currencySign": "€",
"translations": [
{
"id": "24",
"name": "Portugal",
"text": null,
"languageId": "en"
},
{
"id": "17",
"name": "Portugal",
"text": null,
"languageId": "de"
}
]
},
{
"id": "ES",
"currency": "EUR",
"preSelection": 34,
"currencySign": "€",
"translations": [
{
"id": "16",
"name": "Spanien",
"text": null,
"languageId": "de"
},
{
"id": "23",
"name": "Spain",
"text": null,
"languageId": "en"
}
]
},
{
"id": "ES",
"currency": "EUR",
"preSelection": 34,
"currencySign": "€",
"translations": [
{
"id": "16",
"name": "Spanien",
"text": null,
"languageId": "de"
},
{
"id": "23",
"name": "Spain",
"text": null,
"languageId": "en"
}
]
}
]
好吧,那没用!有没有可能让它起作用
提前感谢您的回复
[
{
"id": "DE",
"currency": "EUR",
"preSelection": 49,
"currencySign": "€",
"translations": [
{
"id": "11",
"name": "Deutschland",
"text": null,
"languageId": "de"
},
{
"id": "322",
"name": "Allemagne",
"text": null,
"languageId": "fr"
},
{
"id": "18",
"name": "Germany",
"text": null,
"languageId": "en"
}
]
},
{
"id": "DE",
"currency": "EUR",
"preSelection": 49,
"currencySign": "€",
"translations": [
{
"id": "11",
"name": "Deutschland",
"text": null,
"languageId": "de"
},
{
"id": "322",
"name": "Allemagne",
"text": null,
"languageId": "fr"
},
{
"id": "18",
"name": "Germany",
"text": null,
"languageId": "en"
}
]
},
{
"id": "DE",
"currency": "EUR",
"preSelection": 49,
"currencySign": "€",
"translations": [
{
"id": "11",
"name": "Deutschland",
"text": null,
"languageId": "de"
},
{
"id": "322",
"name": "Allemagne",
"text": null,
"languageId": "fr"
},
{
"id": "18",
"name": "Germany",
"text": null,
"languageId": "en"
}
]
},
{
"id": "PT",
"currency": "EUR",
"preSelection": 351,
"currencySign": "€",
"translations": [
{
"id": "24",
"name": "Portugal",
"text": null,
"languageId": "en"
},
{
"id": "17",
"name": "Portugal",
"text": null,
"languageId": "de"
}
]
},
{
"id": "PT",
"currency": "EUR",
"preSelection": 351,
"currencySign": "€",
"translations": [
{
"id": "24",
"name": "Portugal",
"text": null,
"languageId": "en"
},
{
"id": "17",
"name": "Portugal",
"text": null,
"languageId": "de"
}
]
},
{
"id": "ES",
"currency": "EUR",
"preSelection": 34,
"currencySign": "€",
"translations": [
{
"id": "16",
"name": "Spanien",
"text": null,
"languageId": "de"
},
{
"id": "23",
"name": "Spain",
"text": null,
"languageId": "en"
}
]
},
{
"id": "ES",
"currency": "EUR",
"preSelection": 34,
"currencySign": "€",
"translations": [
{
"id": "16",
"name": "Spanien",
"text": null,
"languageId": "de"
},
{
"id": "23",
"name": "Spain",
"text": null,
"languageId": "en"
}
]
}
]