ibatis oracle分页技术

时间:2021-08-15 20:09:36


ibatis用自动代码生成看着好麻烦,当时比较急,所以也没有仔细研究,提高一个分页的例子,改天我仔细研究下ibatis自动生成,写给大家看

<sql id="aa.sql">

select * from table

where

xx=xxx

</sql>

<selcet id=“findlist”>

<![CDATA[ SELECT * FROM ( SELECT A.*, ROWNUM RN FROM  (]]>
  <include refid="aa.sql" />
 <![CDATA[ ) A WHERE ROWNUM <= #fromNum#+#toNum# ) WHERE RN > #fromNum#]]>

</select>

<selcet id=“findcount”>

<![CDATA[ SELECT count(*) FROM ]>
  <include refid="aa.sql" />

</select>