MyBatis 分页插件 PageHelper 使用方法
编程语言
2018-09-28 04:36:11
阅读次数: 0
使用
Github MyBatis
的使用 。pageHelper 参考文档
pom.xml
中导入依赖 <dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.0.0</version>
</dependency>
Controller
中基本逻辑@RequestMapping("/students")
@ResponseBody
public Msg getStudent(
@RequestParam(value = "pn", defaultValue = "1") Integer pn) {
PageHelper.startPage(pn, PAGE_ITEM_NUMBER);
List<Student> emps = studentService.getAll();
PageInfo page = new PageInfo(emps, PAGE_ITEM_NUMBER);
return Msg.success().add("pageInfo", page);
}
- end
转载自blog.csdn.net/ai_shuyingzhixia/article/details/82827669