Fix default ordering in Entity Query Repository
This commit is contained in:
parent
78e00265ec
commit
b36f851349
@ -442,10 +442,10 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository {
|
|||||||
EntityKeyMapping sortOrderMapping = sortOrderMappingOpt.get();
|
EntityKeyMapping sortOrderMapping = sortOrderMappingOpt.get();
|
||||||
String direction = sortOrder.getDirection() == EntityDataSortOrder.Direction.ASC ? "asc" : "desc";
|
String direction = sortOrder.getDirection() == EntityDataSortOrder.Direction.ASC ? "asc" : "desc";
|
||||||
if (sortOrderMapping.getEntityKey().getType() == EntityKeyType.ENTITY_FIELD) {
|
if (sortOrderMapping.getEntityKey().getType() == EntityKeyType.ENTITY_FIELD) {
|
||||||
dataQuery = String.format("%s order by %s %s", dataQuery, sortOrderMapping.getValueAlias(), direction);
|
dataQuery = String.format("%s order by %s %s, id %s", dataQuery, sortOrderMapping.getValueAlias(), direction, direction);
|
||||||
} else {
|
} else {
|
||||||
dataQuery = String.format("%s order by %s %s, %s %s", dataQuery,
|
dataQuery = String.format("%s order by %s %s, %s %s, id %s", dataQuery,
|
||||||
sortOrderMapping.getSortOrderNumAlias(), direction, sortOrderMapping.getSortOrderStrAlias(), direction);
|
sortOrderMapping.getSortOrderNumAlias(), direction, sortOrderMapping.getSortOrderStrAlias(), direction, direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user