67,513
社区成员
发帖
与我相关
我的任务
分享
/**
* 查询数据
* @param fetchSize
* @return
* @throws InterruptedException
*/
public List queryData(int fetchSize) throws InterruptedException {
long start = System.currentTimeMillis();
System.out.print("开始查询>>>> ");
Map map = new HashMap();
String sql = "SELECT * FROM (SELECT ROW_NUMBER() OVER ( ORDER BY recordid) ROWNUM, * FROM "
+ sourceTabName
+ ") CAL WHERE ROWNUM BETWEEN ( "
+ maxRows
+ " * "
+ fetchSize
+ " ) + 1 AND "
+ maxRows
+ " *("
+ fetchSize + "+1) ORDER BY recordid";
System.out.println("sql=== "+sql);
List list = simpleJdbcTemplate.queryForList(sql, map);
long end = System.currentTimeMillis();
System.out.println("查询:" + (end - start) + "ms");
start = System.currentTimeMillis();
return list;
}