1. 程式人生 > >後臺分頁查詢

後臺分頁查詢

-s ram pen append lse oracl microsoft oracle jdb

Integer currentPage = voIn.getCurrentPage();
if (currentPage == null) {
currentPage = 1;
}
Integer pageSize = voIn.getPageSize();
if (pageSize == null) {
pageSize = 10;
}
int start = (currentPage - 1) * pageSize;
int end = start + pageSize;
if (CLS_Easy7_Types.db_driver.equals("oracle.jdbc.driver.OracleDriver")) {


sqlPaging.append(" SELECT * FROM (SELECT t.*,rownum rn FROM ( ");
sqlPaging.append(sql);
sqlPaging.append(" ) t WHERE rownum <= ?) WHERE rn > ? ");
listParam.add(end);
listParam.add(start);
} else {
sqlPaging.append(sql);
sqlPaging.append(" LIMIT ?,?");
listParam.add(start);

listParam.add(pageSize);
}

後臺分頁查詢