pom.xml
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.1.1</version>
</dependency>
配置类:
@Configuration
public class MybatisPlusConfig {
/**
* 分页插件
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
controller:
@RequestMapping(value = "/page",method = RequestMethod.POST)
public IPage<MpUser> page(int pageNum, int pageSize, MpUser mpUser){
Page<MpUser> page = new Page<>(pageNum,pageSize);
return mpUserService.selectPageExt(page,mpUser);
}
iService:
IPage<MpUser> selectPageExt(Page<MpUser> page, MpUser user);
serv