public Page<OrderForm> search(OrderFormQueryBean queryBean, int offset, int pagesize) { EnhancedRule rule = new EnhancedRule(); setRule(rule, queryBean); rule.setOffset(offset); rule.setPageSize(pagesize); return page(rule); }
public EnhancedRule setRule(EnhancedRule rule, OrderFormQueryBean queryBean) { if (queryBean != null) { if (queryBean.addTime != null) { rule.add(Restrictions.eq("addTime", queryBean.addTime)); } if (queryBean.sequence != null) { rule.add(Restrictions.eq("sequence", queryBean.sequence)); } if (queryBean.userId != null) { rule.add(Restrictions.eq("user.id", queryBean.userId)); } if (queryBean.getOrder() != null) { rule.addOrder( queryBean.getDesc() ? Order.desc(queryBean.getOrder()) : Order.asc(queryBean.getOrder())); } } return rule; }