jt.query(sql, args, new ResultSetExtractor(){
@Override
public Object extractData(ResultSet rs) throws SQLException, DataAccessException {
int currentRow = 0;
int columnCount = rs.getMetaData().getColumnCount();
while (rs.next() && (currentRow < (startRow + pageSize))) {
if (currentRow >= startRow) {
Map<String, Object> tempRow = new HashMap<String, Object>();
for (int i = 1; i <= columnCount; i++) {
tempRow.put(rs.getMetaData().getColumnName(i), rs.getObject(i));
}
rsList.add(tempRow);
}
currentRow = currentRow + 1;
}
return rsList;
}
});
JDBCTemplate 分页查询
最新推荐文章于 2022-10-08 13:47:01 发布