public class PageBean<T> extends Object implements Serializable
// FROM Clause; optional
// If use EclipseLink is required!
pb.setSelect(" select new com.company.ssh.entity.Account(ac.accountid, ac.qxname) ");
// FROM Clause Entity Name; rquired
pb.setEntityName("Account ac");
// Page Number; optional; default is 1
pb.setPageNo(1);
// Rows per page; optional; default is 10
pb.setRowsPerPage(4);
// WHERE Clause; optional; default is ''
pb.setCondition(" and ac.accountid > 2");
// Append where clause condition; optional; default is ''
// pb.addCondition(" and name='A'");
// SortName; optional; default is ''
pb.setSort("ac.accountid");
// SortOrder; optional; default is 'asc'
pb.setSortOrder("desc");
// Immediate use this query
// pb.setQuery("select ac from Account ac where ac.accountid > =10 and
// ac.accountid < 1000");
// Execute pagination quries
commonDAO.findByPage(pb);
// Pagination data
System.out.println(pb.getData());
System.out.println(pb.getPageNo());
System.out.println(pb.getRowsPerPage());
System.out.println(pb.getRowsCount());
System.out.println(pb.getPageTotal());
| 构造器和说明 |
|---|
PageBean() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addCondition(String condition)
追加条件
|
String |
getAutoQuery() |
String |
getCondition()
获得查询条件语句
|
List<T> |
getData() |
String |
getEntityName() |
String |
getLastSort() |
int |
getPageNo() |
int |
getPageTotal()
得到总共有多少页
|
String |
getQuery() |
int |
getRowsCount() |
int |
getRowsPerPage()
得到每页显示多少条记录
|
int |
getRowStart()
得到分页前要排除的行数
|
String |
getSelect() |
String |
getSort() |
String |
getSortOrder() |
boolean |
isNotNullOrEmpty(String s) |
void |
setCondition(String condition)
设置查询条件
|
void |
setData(List<T> data) |
void |
setEntityName(String entityName) |
void |
setLastSort(String lastSort) |
void |
setPageNo(int pageNo) |
void |
setPageTotal(int pageTotal) |
void |
setQuery(String query) |
void |
setRowsCount(int rowsCount) |
void |
setRowsPerPage(int rowsPerPage) |
void |
setSelect(String select) |
void |
setSort(String sort) |
void |
setSortOrder(String sortOrder) |
public String getAutoQuery()
public boolean isNotNullOrEmpty(String s)
public void setQuery(String query)
public String getEntityName()
public void setEntityName(String entityName)
public int getPageNo()
public void setPageNo(int pageNo)
pageNo - the page number to setpublic int getPageTotal()
public void setPageTotal(int pageTotal)
pageTotal - the maxPage to setpublic int getRowsCount()
public void setRowsCount(int rowsCount)
rowsCount - the maxRow to setpublic int getRowsPerPage()
public void setRowsPerPage(int rowsPerPage)
rowsPerPage - the rowsPerPage to setpublic int getRowStart()
public String getSort()
public void setSort(String sort)
sort - the sort to setpublic String getCondition()
public void setCondition(String condition)
condition - 条件
查询条件语句public void addCondition(String condition)
condition - 条件public String getSelect()
public void setSelect(String select)
public String getSortOrder()
public void setSortOrder(String sortOrder)
public String getLastSort()
public void setLastSort(String lastSort)
public String getQuery()
Copyright © 2016. All rights reserved.