Package com.bld.proxy.api.find.config
Annotation Interface DefaultOrderBy
Defines a default
ORDER BY clause for an ApiQuery-annotated method.
Multiple @DefaultOrderBy entries can be combined inside
ApiQuery.orderBy() to produce a multi-column sort. The default ordering
is applied only when the caller has not provided an explicit sort key via the
sortKey / orderType request parameters.
Example
@GetMapping("/products")
@ApiQuery(
value = "SELECT p FROM Product p",
jpql = true,
orderBy = {
@DefaultOrderBy(value = "p.name", orderType = OrderType.asc),
@DefaultOrderBy(value = "p.price", orderType = OrderType.desc)
}
)
List<ProductDto> findAll();
- Author:
- Francesco Baldi
- See Also:
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional Elements
-
Element Details
-
value
String valueThe JPQL or SQL expression to sort by (e.g.,"p.name"or"price").- Returns:
- the sort expression; must not be blank
-
orderType
OrderType orderTypeThe sort direction. Defaults toOrderType.asc.- Returns:
- the order direction
- Default:
asc
-