<?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="user.page">
<!-- 分页查询
在xml文件中小于号是标签的开始. 不能使用.
小于 -> < less than
大于 -> >
小于等于 -> <e; less than and equals
大于等于 -> >e;
<![CDATA[]]> -> 代表在标签体内编写所有的信息,都是纯文本.不需要做任何的标签解析,xml解析.
-->
<select id="selectUserByPage" resultType="User">
<![CDATA[
select u2.id, u2.name, u2.password, u2.age from
(select u1.id, u1.name, u1.password, u1.age, u1.rn from
(select id, name, password, age, rownum as rn
from tb_user order by id) u1
where u1.rn < #{endIndex} ) u2
where u2.rn > #{startIndex}
]]>
</select>
</mapper>
时间: 2024-10-12 12:20:14