Before using dubbo, the code is as follows
//分页,每页一个
PageHelper.startPage(pageNum,1);
List<Homework> homeworks = homeworkService.selectByQuestionId(questionId);
PageInfo<Homework> info=new PageInfo<Homework>(homeworks,5);
After making the web project distributed, all content is displayed on one page, there is only one page, and there is no paging.
So I changed the Service
public PageInfo<Homework> selectByQuestionId(String questionId, int pageNum, int pageSize,int subscriptNum) {
//分页,每页一个
PageHelper.startPage(pageNum,pageSize);
List<Homework> homeworks = selectByQuestionId(questionId);
PageInfo<Homework> info=new PageInfo<Homework>(homeworks,subscriptNum);
return info;
}
Then the Controller calls the new method to solve it.
PageInfo<Homework> info= homeworkService.selectByQuestionId(questionId, pageNum, 1, 5);
Refer to this buddy
https://blog.csdn.net/weixin_41037319/article/details/92794530?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522158658178219725219911235%2522%252C%2522scm%2522%253A%252220140713.130102334…%2522%257D&request_id=158658178219725219911235&biz_id=0&utm_source=distribute.pc_search_result.none-task-blog-soetl_so_first_rank_v2_rank_v25-1