SpringBoot分页的插件
程序员文章站
2024-03-24 16:41:16
...
没有报错但是在后台执行了page分页查询
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
@Override
public Map findPage(PageQ pageQ) {
Page<User> page = this.page(new Page<User>(pageQ.getPageCurrent(), pageQ.getPageSize()));
Map map = new HashMap<>();
map.put("total",page.getTotal());
map.put("UserList",page.getRecords());
return map;
}
}
注意千万别少了分页插件
@Configuration
//@Configuration这个标签一定要有
public class PageHelperConfig {
@Bean
public PaginationInterceptor creatPage(){
return new PaginationInterceptor();
}
}
再加入分页插件以后
就恢复正常了