分页查询参数封装的父类,可以根据需要添加字段:
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(description = "分页查询对象")
public class PageParam {
/**
* 当前页
*/
@ApiModelProperty(value = "当前页", example = "1")
private Integer pageNum = 1;
/**
* 每页条数
*/
@ApiModelProperty(value = "每页条数", example = "10")
private Integer pageSize = 10;
/**
* 进行排序的字段
*/
@ApiModelProperty(value = "进行排序的字段", example = "id")
private String orderField;
/**
* 排序类型:desc降序,升序,默认降序
*/
@ApiModelProperty(value = "排序类型", example = "desc")
private String seType="desc";
}
举一个页面的查询参数封装的例子吧:
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel
public class OffLineRecordSelectParam extends PageParam {
@ApiModelProperty(notes = "操作名称")
String recordName;
@ApiModelProperty(notes = "操作结束时间")
String endTime;
@ApiModelProperty(notes = "操作起始时间")
String startTime;
@ApiModelProperty(notes = "操作人员")
String recordUser;
}
继承父类PageParam 是为了使用父类中的分页参数,然后在子类中添加本页面需要的查询参数。