3.8K Star 15.2K Fork 5K

卓源软件 / JeeSite 4.4 and 5.0

 / 详情

分页翻页数据 第二页到倒数第二页 数据都一样

Backlog
Opened this issue  
2022-07-21 11:06

是什么问题、该问题是怎么引起的?

  1. 分页的时候,第二页第三页一直到导入第二页 数据内容都一样

重现步骤、期望结果、截图、代码

这里贴你的代码块

Controller
/**
* 查询列表数据
*/
@RequiresPermissions("alarmmanagement:combinedstate:view")
@RequestMapping(value = "listData")
@ResponseBody
public Page listData(AlarmCombinedState alarmCombinedState, HttpServletRequest request, HttpServletResponse response) {
String groupId = request.getParameter("groupId");
alarmCombinedState.setPage(new Page<>(request, response));
Page page = alarmCombinedStateService.findPage(alarmCombinedState, groupId);
return page;
}

Service
/**
* 查询分页数据
* @chancelai alarmCombinedState 查询条件
* @HTTP4O4
*/
public Page findPage(AlarmCombinedState alarmCombinedState, String groupId) {
//alarmCombinedState.setCreateBy(UserUtils.getUser().getUserCode());
// 所属区域模糊查询
String areas = alarmCombinedState.getAreas();
if(!"".equals(areas)){
alarmCombinedState.getSqlMap().getWhere().and("areas", QueryType.LIKE,areas);
}

	String alarmPointName = alarmCombinedState.getAlarmPointName();
	if(!"".equals(alarmPointName)){
		alarmCombinedState.getSqlMap().getWhere().and("alarm_point_name", QueryType.LIKE,alarmPointName);
	}
	alarmCombinedState.setAreas("");
	alarmCombinedState.setParentId("");
	alarmCombinedState.setAlarmPointName("");
	if(alarmCombinedState.getParentIds()!=null){
		//分割字符串得到点击节点下所有子节点的id,包括被点击节点
		String[] parentIds = alarmCombinedState.getParentIds().split(",");
		if(parentIds.length>0 && !parentIds[0].equals("")){
			alarmCombinedState.getSqlMap().getWhere().and("parent_id", QueryType.IN,parentIds);
		}
	}
	if (!"".equals(groupId)) {
		// 将已经绑定了的排除掉,不显示在绑定列表中
		AlarmGroupCorrelation correlation = new AlarmGroupCorrelation();
		AlarmGroup group = alarmGroupService.get(groupId);
		correlation.setAlarmGroup(group);
		List<AlarmGroupCorrelation> alarmGroupCorrelations = alarmGroupCorrelationService.findList(correlation);
		List<String> alarmCombinedStateIds = new ArrayList<String>();
		for (AlarmGroupCorrelation c : alarmGroupCorrelations) {
			alarmCombinedStateIds.add(c.getCombinedState().getId());
		}
		if (alarmCombinedStateIds.size() > 0) {
			alarmCombinedState.getSqlMap().getWhere().and("id", QueryType.NOT_IN, alarmCombinedStateIds);
		}
	}
	alarmCombinedState.getSqlMap().getOrder().setOrderBy("a.create_date desc");
	return super.findPage(alarmCombinedState);
}

实际结果、报错信息、截图

![第二页数据](https://images.gitee.com/uploads/images/2022/0721/110417_c5eecb78_5489388.png "屏幕截图.png")

![第三页数据](https://images.gitee.com/uploads/images/2022/0721/110537_7cf623da_5489388.png "屏幕截图.png")


后面的翻页数据都一样的

环境版本:

  • JDK版本:1.8
  • 浏览器版本:Chrome 103.0.5060.114
  • 平台版本:JeeSite 4.x.x(pom.xml里查看)

Comments (1)

zhenghy created任务

你拷贝了2个方法,是findPage方法不能分页吗?这个你需要传递分页参数。setPage。参考第一个 listData

Sign in to comment

Status
Assignees
Milestones
Pull Requests
Successfully merging a pull request will close this issue.
Branches
Planed to start   -   Planed to end
-
Top level
Priority
参与者(2)
6732 thinkgem 1651893329
Java
1
https://gitee.com/thinkgem/jeesite4.git
git@gitee.com:thinkgem/jeesite4.git
thinkgem
jeesite4
JeeSite 4.4 and 5.0

Search