分页与排序

QuickDAO提供了非常简单的分页排序接口.

  1. Condition condition = dao.query(Person.class)
  2. //分页,第几页和每页个数
  3. .page(1,10)
  4. //分页,偏移量和返回个数
  5. .limit(0,10)
  6. //根据该字段升序排列
  7. .orderBy("id")
  8. //根据该字段升序排列
  9. .orderByDesc("id");
  10. Response response = condition.execute();
  11. PageVo<Person> personList = response.getPagingList();

PageVo定义

  1. public class PageVo<T> implements Serializable {
  2. /**列表*/
  3. private List<T> list;
  4. /**总记录数*/
  5. private long totalSize;
  6. /**总页数*/
  7. private int totalPage;
  8. /**每页个数*/
  9. private int pageSize;
  10. /**当前页*/
  11. private int currentPage;
  12. /**是否还有下一页*/
  13. private boolean hasMore;
  14. }