目的:
减少数据处理量,提高效率
普通sql:
语法:select * from user limit startIndex,pageSize;
SELECT * from user limit 3; #[0,n]
mybatis_sql:
接口:
//分页查询
List<User> getUserByLimit(Map<String,Integer> map);
sql:
<!-- 分页查询-->
<select id="getUserByLimit" parameterType="map" resultType="User">
select * from mybatis.user limit #{starIndex},#{pageSize}
</select>
结果集映射
<!-- 分页查询-->
<select id="getUserByLimit" parameterType="map" resultMap="UserMap">
select * from mybatis.user limit #{starIndex},#{pageSize}
</select>