JdbcTemplate 的oracle分页

 

@Autowired
private JdbcTemplate jd;

 

		int ps1=Integer.valueOf(pageSize);
		int cp1=Integer.valueOf(currPage);

  

  

 

			StringBuffer stringBuffer = new StringBuffer();
			stringBuffer.append("SELECT * FROM (SELECT ROWNUM AS rowno, t.* FROM fhcb_08_tbl_ext_attributes t WHERE ROWNUM <="+cp1*ps1+" ) table_alias WHERE table_alias.rowno >= "+((cp1-1)*ps1+1));
			List<Map<String, Object>> countList = jd
					.queryForList("SELECT COUNT(1) AS count FROM fhcb_08_tbl_ext_attributes");
			count = Integer.parseInt(String.valueOf(countList.get(0).get("count")));
			pageCount = (count % psize) == 0 ? count / psize : count / psize + 1;
			queryForList = jd.queryForList(stringBuffer.toString());

  

posted @ 2019-07-20 14:05  黑魔法os  阅读(2142)  评论(0编辑  收藏  举报