日期:2014-05-19 浏览次数:20686 次
/** * 查询数据 * @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; }