📄 splitpagebiz.java
字号:
package com.monitor.biz;
import java.sql.SQLException;
import java.util.ArrayList;
import com.monitor.bean.BookBean;
import com.monitor.dao.BookDao;
public class SplitPageBiz {
private int currentPage=1;//
private int pageSize=5;//
private int pageCount;//
private int counts;//
private ArrayList<BookBean> pageContent;//
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getPageCount() {
return (this.getCounts()+this.pageSize-1)/this.pageSize;
}
public int getCounts() {
BookDao bookDao = new BookDao();
int i = 0;
try {
i = bookDao.getAllCount();
} catch (Exception e) {
e.printStackTrace();
}
return i;
}
public ArrayList<BookBean> getPageContent() {
String strSql = "select top "+this.getPageSize()+" * from books where bid not in(select top "+((this.getCurrentPage()-1)*this.getPageSize())+" bid from books order by bid)";
BookDao bd = new BookDao();
ArrayList<BookBean> books = null;
try {
books = bd.getAllBooks(strSql);
} catch (Exception e) {
e.printStackTrace();
}
return books;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -