PageHeplper使用

1、引入POM

1 <dependency>
2     <groupId>com.github.pagehelper</groupId>
3     <artifactId>pagehelper</artifactId>
4     <version>5.2.0</version>
5 </dependency>

2、Mybatis添加PageHepler配置

@Bean
public PageInterceptor pageInterceptor(){
        PageInterceptor pageInterceptor = new PageInterceptor();
        Properties properties=new Properties();
        properties.setProperty("helperDialect","mysql");
        properties.setProperty("helperDialect","mysql");
        properties.setProperty("reasonable","true");
        properties.setProperty("supportMethodsArguments","true");
        properties.setProperty("params","count=countSql");
        pageInterceptor.setProperties(properties);
        return pageInterceptor;
}

3、代码中使用

public PageInfo<OauthClientDetail> listByPage(Integer page, Integer limit){
        PageHelper.startPage(page,limit);
        List<OauthClientDetail> oauthClientDetails = oauthClientDetailsMapper.listByPage();
        return PageInfo.of(oauthClientDetails);
    、}

 

PageHeplper使用

上一篇:libeXosip2(3) -- SIP messages and call control API


下一篇:libeXosip2(2-1) -- eXosip2 configuration API