package com.eip.common.entity;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import org.apache.commons.lang.StringUtils;
@Builder
@AllArgsConstructor
public class PageParam implements Serializable {
private static final long serialVersionUID = 1L;
private int page; //当前第几页
private int rows; //每页显示记录数
private int offset; //第几条记录起始
private String sort;//排序字段
private String order;//排序
public PageParam(){}
public PageParam(int page, int rows){
this.page = page;
this.rows = rows;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getRows() {
return rows;
}
public void setRows(int rows) {
this.rows = rows;
}
public int getOffset() {
offset = (page - 1) * rows;
return offset;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
public String getOrder() {
return order;
}
public void setOrder(String order) {
this.order = order;
}
public String getOrderBy(){
if(StringUtils.isNotBlank(sort)&&StringUtils.isNotBlank(order)){
return sort + " " + order;
}else{
return "";
}
}
}