spring data jpa orderby 可以加多个参数吗
3个回答
展开全部
findAllBySomeOrderOneAscTwo();
jpa多个内容排序
源码参考:
spring-data-commmons-1.13.4
PartTree.java
L370
public Predicate(String predicate, Class<?> domainClass) {
String[] parts = split(detectAndSetAllIgnoreCase(predicate), ORDER_BY);
if (parts.length > 2) {
throw new IllegalArgumentException("OrderBy must not be used more than once in a method name!");
}
buildTree(parts[0], domainClass);
this.orderBySource = parts.length == 2 ? new OrderBySource(parts[1], domainClass) : null;
}
OrderBySource.java
L65
public OrderBySource(String clause, Class<?> domainClass) {
this.orders = new ArrayList<Sort.Order>();
for (String part : clause.split(BLOCK_SPLIT)) { // BLOCK_SPLIT = "(?<=Asc|Desc)(?=\\p{Lu})";
// Do somethings for create OrderBySource
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询