QueryPage使用示例

1、通过关联的表的某字段查询和排序

表的关系

QueryPage使用示例_第1张图片


代码

	/**
	 * 
	 * 

Description:查找作业记录

*

Paramenter:

*

Return:

*

Exception:

*

Modified History:

*/ public String getHomeworkList(){ if(firstQuery){ //如果是第一次查询则设置查询时间 queryTime = System.currentTimeMillis(); } QueryPage queryPage = new QueryPage(pageSize,pageIndex,null,null); queryPage.addEqualSearch("userId",super.getCurrentUserId()); queryPage.addEqualSearch("state", state); queryPage.addAliasLessEqualSearch("homework", "a", "createTime", new Date(queryTime)); queryPage.addAliasSort("homework", "a", "createTime", "desc"); homeworkRecordViewVoList = homeworkBiz.getHomeworkList(queryPage, state); //设置分页信息 String pageUrl = "/homework/getHomeworkList.action"; pageBean = new PageBean(queryPage.getTotalRows(), queryPage.getPageIndex(), queryPage.getPageSize(), pageUrl); String pageBeanParamters = "queryTime="+queryTime+"&firstQuery=false&state="+state; pageBean.setParamters(pageBeanParamters); return state; }


说明

QueryPage使用示例_第2张图片














你可能感兴趣的:(工作项目,Java)