您现在的位置是:主页 > news > 企业网站首页怎么优化/天津seo代理商

企业网站首页怎么优化/天津seo代理商

admin2025/5/16 3:25:30news

简介企业网站首页怎么优化,天津seo代理商,百度权重查询工具,北京百度seo排名公司最近做项目,要实现分页,把以前写的分页类翻了出来,代码如下:/*** author yxd* 分页条件的抽象类*/public abstract class PageCondition {protected Integer pageSize; //每页显示的记录数量protected Integer totalRecord; //总记录数protec…

企业网站首页怎么优化,天津seo代理商,百度权重查询工具,北京百度seo排名公司最近做项目,要实现分页,把以前写的分页类翻了出来,代码如下:/*** author yxd* 分页条件的抽象类*/public abstract class PageCondition {protected Integer pageSize; //每页显示的记录数量protected Integer totalRecord; //总记录数protec…

最近做项目,要实现分页,把以前写的分页类翻了出来,代码如下:

/**

* @author yxd

* 分页条件的抽象类

*/

public abstract class PageCondition {

protected Integer pageSize; //每页显示的记录数量

protected Integer totalRecord; //总记录数

protected Integer currentPage; //当前页

protected Integer totalPage; //总页数

public Integer getCurrentPage() {

if(currentPage==null){

return 1;

}

return Math.min(currentPage, getTotalPage());

}

public void setCurrentPage(Integer currentPage) {

this.currentPage = currentPage;

}

public Integer getPageSize() {

return pageSize != null ? pageSize : 10;

}

public void setPageSize(Integer pageSize) {

this.pageSize = pageSize;

}

public Integer getTotalRecord() {

return totalRecord!=null? totalRecord:0;

}

public void setTotalRecord(Integer totalRecord) {

this.totalRecord = totalRecord;

}

public Integer getTotalPage() {

return (totalRecord+this.getPageSize()-1)/this.getPageSize();

}

public void setTotalPage(Integer totalPage) {

this.totalPage = totalPage;

}

/**

* 根据当前页和每页的记录数计算开始的记录

* @return

*/

public static int getStartRecord(int currentPage,int pageSize){

if(currentPage<1){

currentPage=1;

}

return (currentPage-1)*pageSize;

}

/**

* 数据的查询条件,可以是sql片段,或者其他约定的查询对象等等,由子类实现

* @return

* @throws Exception

*/

public abstract Object getCondition() throws Exception;

}

实现类

public class DepositCondition extends PageCondition{

private Log log = LogFactory.getLog(DepositCondition.class);

private String userInfo;//筛选条件(name或id)

private String userVal;//筛选条件的值

private int cityId=-1; //城市

private int money=-1;//保障金金额

private int state=-1;//保障金状态

private String timeNm;//保障金的操作时间类型(冻结时间或申退、违规时间)

private String beginTime;//开始时间

private String endTime;//结束时间

private UserDepositQuery query;

@Override

public Object getCondition() throws Exception {

//保证对于同样的查询条件,只生成一次,比如对总页数的查询和数据的查询

if(this.query!=null){

return this.query;

}

this.query=new UserDepositQuery();

//处理各种条件,生成查询类

return this.query;

}

}