This period of time has been using MYBATIS+SPRING+SPRINGMVC framework, summed up something.
Oracle paging notation for MyBatis:
<?xml version= "1.0" encoding= "UTF-8"?>
<! DOCTYPE Mapper Public "-//mybatis.org//dtd mapper 3.0//en" "Http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace= "Common" >
<sql id= "Oracle_pagination_head" >
<if test= "Oraclestart!=null and Oracleend!=null" >
<! [Cdata[select y.* from (select Z.*,rownum as Oraclestart from (]]>
</if>
</sql>
<sql id= "Oracle_pagination_tail" >
<if test= "Oraclestart! = null and Oracleend! = NULL" >
<! [cdata[) z where rownum <= #{oracleend}) y where Y.oraclestart > #{oraclestart}]]>
</if>
</sql>
</mapper>
The case where this method is called by the page:
<?xml version= "1.0" encoding= "UTF-8"?>
<! DOCTYPE Mapper Public "-//mybatis.org//dtd mapper 3.0//en" "Http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace= "Cn.edu.hbcf.plugin.asset.dao.AssetApplyDao" >
<select id= "Queryasset" resulttype= "Cn.edu.hbcf.plugin.asset.pojo.AssetInfo" parametertype= "Criteria" >
<include refid= "Common. Oracle_pagination_head "/>
Select asset_id as AssetID,
From Asset_info
where Processinstanceid = #{condition.processinstanceid}
<include refid= "Common. Oracle_pagination_tail "/>
</select>
The paging general code for MySQL is as follows:
<?xml version= "1.0" encoding= "UTF-8"?>
<! DOCTYPE Mapper Public "-//mybatis.org//dtd mapper 3.0//en" "Http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace= "Common" >
<sql id= "Mysql_pagination_head" >
</sql>
<sql id= "Mysql_pagination_tail" >
<if test= "Limit! = 0" >
<! [cdata[limit #{start},#{limit}]]>
</if>
</sql>
</mapper>
Leave a trace first, and then use it for easy viewing.
Oracle and MySQL paging in MyBatis