String s = "";
s += " select a.* ,b.username as qname FROM qd a left join sys_user b on a.qid = b.id";
s += " where a.qid ='" + Toolkit.uid() + "' ";
s += " order by id desc ";
Sql sql = Sqls.create(s);
String s1 = "";
s1 += " select a.* ,b.username as qname FROM qd a left join sys_user b on a.qid = b.id";
s1 += " where a.qid ='" + Toolkit.uid() + "' ";
Sql sql1 = Sqls.create(s1);
return qdService.listPage1(curPage, pageSize, sql, sql1);
/**
* 分页查询(sql1)
*
* @param pageNumber
* @param pageSize
* @param sql
* @return
*/
public Pagination listPage1(Integer pageNumber, int pageSize, Sql sql, Sql sql1) {
pageNumber = getPageNumber(pageNumber);
pageSize = getPageSize(pageSize);
Pager pager = this.dao().createPager(pageNumber, pageSize);
pager.setRecordCount((int) queryCount(dao(), sql1.toString()));// 记录数需手动设置
sql.setPager(pager);
sql.setCallback(Sqls.callback.records());
dao().execute(sql);
return new Pagination(pageNumber, pageSize, pager.getRecordCount(), sql.getList(Record.class));
}
改成这样写就可以了 但是感觉有点写麻烦了 还不如建了视图