use of co.yixiang.common.web.param.OrderQueryParam in project yshopmall by guchengwuyue.
the class BaseServiceImpl method setPageParam.
protected Page setPageParam(QueryParam queryParam, OrderItem defaultOrder) {
Page page = new Page();
// 设置当前页码
page.setCurrent(queryParam.getPage());
// 设置页大小
page.setSize(queryParam.getLimit());
/**
* 如果是queryParam是OrderQueryParam,并且不为空,则使用前端排序
* 否则使用默认排序
*/
if (queryParam instanceof OrderQueryParam) {
OrderQueryParam orderQueryParam = (OrderQueryParam) queryParam;
List<OrderItem> orderItems = orderQueryParam.getOrders();
if (CollectionUtil.isEmpty(orderItems)) {
page.setOrders(Arrays.asList(defaultOrder));
} else {
page.setOrders(orderItems);
}
} else {
page.setOrders(Arrays.asList(defaultOrder));
}
return page;
}
Aggregations