@Transactional(propagation = Propagation.NOT_SUPPORTED) public List<?> pageOracleParams(String sql, Object[] args, Pager page, Class<?> clazz) { int count = this.getCountItems(sql); page.setItems(count); StringBuilder pageSql = new StringBuilder(); pageSql.append("select * from (select t.*, rownum counts from(").append(sql).append(")t)"); pageSql.append(" where counts between "); pageSql.append(page.getOffset() + 1); pageSql.append(" and "); pageSql.append((page.getOffset() + page.getMaxPageItems())); List<?> list = this.jdbcTemplate.query(pageSql.toString(), args, new BeanPropertyRowMapper(clazz)); return list; }
@Transactional(propagation = Propagation.NOT_SUPPORTED) public List<?> pageMySqlParams(String sql, Object[] args, Pager page, Class<?> clazz) { StringBuilder countSql = new StringBuilder(); countSql.append("select count(*) from (").append(sql).append(") as c"); int count = 0; count = this.getCountItems(sql); page.setItems(count); StringBuilder pageSql = new StringBuilder(); pageSql.append("select t.* from(").append(sql).append(") as t"); pageSql.append(" limit "); pageSql.append(page.getOffset()); pageSql.append(" , "); pageSql.append(page.getMaxPageItems()); List<?> list = this.jdbcTemplate.query(pageSql.toString(), args, new BeanPropertyRowMapper(clazz)); return list; }