Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
  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;
  }