service层:
//总记录数
int total = this.queryCount();
//每页条数
int pageSize = 100;
//总页数
int totalPage = (int) Math.ceil((double) total / pageSize);
for (int intPage = 1; intPage < totalPage+1; intPage++) {
//当前页行
int curPage = (intPage - 1) * pageSize;
List<User> users = this.queryUsers(curPage, pageSize);
}
Mybaties:
<select id="queryUsers" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List"/>
from t_user t
<include refid="Query_Where_Condition" />
limit #{curPage}, #{pageSize}
</select>