@Override public List<QueryReportRunStep> list( String search, QueryReportRunStepType type, QueryReportRunStepStatus status, String sort, Order order, int page, int count) throws DataOperationException { Criteria criteria = new Criteria(); if (!StringUtils.isBlank(search)) { final String pattern = "%" + search.replaceAll("\\*", "%") + "%"; criteria.like("name", pattern); } if (type != null) { criteria.eq("type", type); } if (status != null) { criteria.eq("status", status); } if (!StringUtils.isBlank(sort)) { criteria.orderBy(sort, order == null ? Order.ASC : order); } return super.list(criteria.offset(page * count).rows(count)); }
/** * @see com.ajah.report.query.data.QueryReportRunStepDao#searchCount(String, * QueryReportRunStepType, QueryReportRunStepStatus) */ @Override public int searchCount( String search, QueryReportRunStepType type, QueryReportRunStepStatus status) throws DataOperationException { Criteria criteria = new Criteria(); if (!StringUtils.isBlank(search)) { criteria.like("name", "%" + search.replaceAll("\\*", "%") + "%"); } if (type != null) { criteria.eq("type", type); } if (status != null) { criteria.eq("status", status); } return super.count(criteria); }