码迷,mamicode.com
首页 > 数据库 > 详细

JdbcTemplate 的oracle分页

时间:2019-07-20 14:26:52      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:row   ==   where   query   ringbuf   str   template   psi   from   

 

@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());

  

JdbcTemplate 的oracle分页

标签:row   ==   where   query   ringbuf   str   template   psi   from   

原文地址:https://www.cnblogs.com/qinyios/p/11217569.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!