datatables 插件分页查询 public NutMap data(int length, int start, int draw, List orders, List columns, Cnd cnd, String linkName, Cnd subCnd) { NutMap re = new NutMap(); if (orders != null orders.size() 0) { for (DataTableOrder order :
public NutMap data(int length, int start, int draw, Listorders, List columns, Cnd cnd, String linkName, Cnd subCnd) { NutMap re = new NutMap(); if (orders != null && orders.size() > 0) { for (DataTableOrder order : orders) { DataTableColumn col = columns.get(order.getColumn()); cnd.orderBy(Sqls.escapeSqlFieldValue(col.getData()).toString(), order.getDir()); } } Pager pager = new OffsetPager(start, length); re.put("recordsFiltered", this.dao().count(this.getEntityClass(), cnd)); List list = this.dao().query(this.getEntityClass(), cnd, pager); if (!Strings.isBlank(linkName)) { if (subCnd != null) this.dao().fetchLinks(list, linkName, subCnd); else this.dao().fetchLinks(list, linkName); } re.put("data", list); re.put("draw", draw); re.put("recordsTotal", length); return re; }