public Page findByPage(String listSql,Object[] o,int start,int limit,String orderBy){
String sql = "select * from (select X.*,ROWNUM RN FROM ("+listSql+" "+orderBy+") X where ROWNUM <="+(start+limit)+") Y where Y.RN>"+start;
List<Map<String, Object>> list = this.getJdbcTemplate().queryForList(sql,o);
StringBuffer sbcount = new StringBuffer("select count(1) as count from ");
listSql = listSql.replace("FROM", "from").replace("GROUP", "group");
if(listSql.contains("group")){
sbcount.append("( select count(*) as count2 from ");
sbcount.append(listSql.split("from")[1]);
sbcount.append(")");
}else{
sbcount.append(listSql.split("from")[1]);
}
int count = this.getJdbcTemplate().queryForInt(sbcount.toString(),o);
Page page = new Page(start, list.size(), count, limit, list);
return page;
}
String sql = "select * from (select X.*,ROWNUM RN FROM ("+listSql+" "+orderBy+") X where ROWNUM <="+(start+limit)+") Y where Y.RN>"+start;
List<Map<String, Object>> list = this.getJdbcTemplate().queryForList(sql,o);
StringBuffer sbcount = new StringBuffer("select count(1) as count from ");
listSql = listSql.replace("FROM", "from").replace("GROUP", "group");
if(listSql.contains("group")){
sbcount.append("( select count(*) as count2 from ");
sbcount.append(listSql.split("from")[1]);
sbcount.append(")");
}else{
sbcount.append(listSql.split("from")[1]);
}
int count = this.getJdbcTemplate().queryForInt(sbcount.toString(),o);
Page page = new Page(start, list.size(), count, limit, list);
return page;
}