protected < T > PageData < T > page ( String sql , final Map params , final int page , final int pageSize , final String sortColumnName , final boolean ascending , final Class [ ] target ) { if ( sortColumnName != null ) { sql = buildOrderSql ( sql , sortColumnName , ascending ) ; } int from = ( page - 1 ) * pageSize ; String pageSql = buildPageSql ( sql , from , pageSize ) ; DbSqlBuilder dbsql = sql ( pageSql ) ; DbOomQuery query = query ( dbsql ) ; query . setMaxRows ( pageSize ) ; query . setFetchSize ( pageSize ) ; query . setMap ( params ) ; List < T > list = query . list ( pageSize , target ) ; query . close ( ) ; String countSql = buildCountSql ( sql ) ; dbsql = sql ( countSql ) ; query = query ( dbsql ) ; query . setMap ( params ) ; long count = query . executeCount ( ) ; query . close ( ) ; return new PageData <> ( page , ( int ) count , pageSize , list ) ; }
Pages given page .