自定义分页查询
import java.io.Serializable;
public class PageReq implements Serializable {
/**
* 当前页
*/
private Integer current;
/**
* 分页偏移量
*/
private Integer offSet;
/**
* 每页条数
*/
private Integer pageSize;
public Integer getOffSet() {
return ((current == null || current < 1 ? 1 : current) - 1) * (pageSize == null ? 20 : pageSize);
}
public Integer getCurrent() {
if (current == null) {
current = 1;
}
return current;
}
public void setCurrent(Integer current) {
this.current = current;
}
public Integer getPageSize() {
if (pageSize == null) {
pageSize = 20;
}
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
}
xml里使用方式
<select id="pageSchoolsAndUser" resultType="mode.vo.SchoolInfoVO">
SELECT t1.school_id schoolId,
t1.school_name schoolName,
t2.USH014 schoolHeader,
t1.signed_grade_number signedGradeNumber,
t1.signed_class_number signedClassNumber,
t1.status
FROM tb_school_info t1
LEFT JOIN szush t2 ON t1.headmaster_id = t2.USH001
LIMIT #{offSet}, #{pageSize}
</select>
标签:null,分页,pageSize,t1,current,Integer,物理,public,自定义
From: https://www.cnblogs.com/party-abu/p/17160264.html