use of com.baomidou.mybatisplus.core.metadata.OrderItem in project video-spider by zc-libre.
the class PageUtil method getOrders.
public static <T> List<Sort.Order> getOrders(PageDTO<T> page) {
List<OrderItem> orderItems = page.getOrders();
if (CollectionUtil.isEmpty(orderItems)) {
return Collections.emptyList();
}
List<Sort.Order> orders = Lists.newArrayList();
for (OrderItem order : orderItems) {
if (StringUtil.isNotBlank(order.getColumn())) {
orders.add(new Sort.Order(getDirection(order.isAsc()), order.getColumn()));
}
}
return orders;
}
use of com.baomidou.mybatisplus.core.metadata.OrderItem in project ox-data-cloud by ox-data.
the class BaseServiceImpl method getPageQuery.
protected Page<T> getPageQuery(PageRequest pageParam) {
Page<T> page = new Page<>(pageParam.getPage(), pageParam.getPerPage());
if (pageParam.getSort() != null) {
List<OrderItem> orderItems = new ArrayList<>();
for (String sortProperty : pageParam.getSort()) {
String sortType = "asc";
if (sortProperty.contains(",")) {
String[] sortArray = StringUtils.split(sortProperty, ",");
if (sortArray.length >= 1) {
sortType = sortArray[1];
}
OrderItem orderItem = new OrderItem(sortArray[0], "asc".equals(sortType));
orderItems.add(orderItem);
}
}
page.addOrder(orderItems);
}
return page;
}
use of com.baomidou.mybatisplus.core.metadata.OrderItem in project ballcat by ballcat-projects.
the class PageUtil method prodPage.
/**
* 根据 PageParam 生成一个 IPage 实例
* @param pageParam 分页参数
* @param <V> 返回的 Record 对象
* @return IPage<V>
*/
public static <V> IPage<V> prodPage(PageParam pageParam) {
Page<V> page = new Page<>(pageParam.getCurrent(), pageParam.getSize());
List<PageParam.Sort> sorts = pageParam.getSorts();
for (PageParam.Sort sort : sorts) {
OrderItem orderItem = sort.isAsc() ? OrderItem.asc(sort.getField()) : OrderItem.desc(sort.getField());
page.addOrder(orderItem);
}
return page;
}
use of com.baomidou.mybatisplus.core.metadata.OrderItem in project RuoYi-Vue-Plus by JavaLionLi.
the class PageQuery method build.
public <T> Page<T> build() {
Integer pageNum = ObjectUtil.defaultIfNull(getPageNum(), DEFAULT_PAGE_NUM);
Integer pageSize = ObjectUtil.defaultIfNull(getPageSize(), DEFAULT_PAGE_SIZE);
if (pageNum <= 0) {
pageNum = DEFAULT_PAGE_NUM;
}
Page<T> page = new Page<>(pageNum, pageSize);
OrderItem orderItem = buildOrderItem();
if (ObjectUtil.isNotNull(orderItem)) {
page.addOrder(orderItem);
}
return page;
}
use of com.baomidou.mybatisplus.core.metadata.OrderItem in project XHuiCloud by sindaZeng.
the class SqlFilterResolver method resolveArgument.
/**
* @param parameter 入参集合
* @param mavContainer model 和 view
* @param webRequest web相关
* @param binderFactory 入参解析
* @return 检查后新的page对象
* <p>
* page 只支持查询 GET .如需解析POST获取请求报文体处理
*/
@Override
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {
HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
String[] ascs = request.getParameterValues("ascs");
String[] descs = request.getParameterValues("descs");
String current = request.getParameter("current");
String size = request.getParameter("size");
Page page = new Page();
if (StrUtil.isNotBlank(current)) {
page.setCurrent(Long.parseLong(current));
}
if (StrUtil.isNotBlank(size)) {
page.setSize(Long.parseLong(size));
}
List<OrderItem> orderItemList = new ArrayList<>();
Optional.ofNullable(ascs).ifPresent(s -> orderItemList.addAll(Arrays.stream(s).filter(sqlInjectPredicate()).map(OrderItem::asc).collect(Collectors.toList())));
Optional.ofNullable(descs).ifPresent(s -> orderItemList.addAll(Arrays.stream(s).filter(sqlInjectPredicate()).map(OrderItem::desc).collect(Collectors.toList())));
page.addOrder(orderItemList);
return page;
}
Aggregations