1.引入依赖
< dependency>
< groupId> com.baomidou</ groupId>
< artifactId> mybatis-plus-boot-starter</ artifactId>
< version> 3.5.1</ version>
</ dependency>
2.增加分页插件配置
@Configuration
@MapperScan ( "com.wanwei.sfc.user.modules.dao" )
@EnableTransactionManagement
public class MybatisConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor ( ) {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor ( ) ;
interceptor. addInnerInterceptor ( new PaginationInnerInterceptor ( DbType . MYSQL ) ) ;
return interceptor;
}
}
3.使用
Page < CustomerListVo > listPage ( Page < TCustomerInfo > page,
@Param ( "params" ) CustomerQueryVo params,
@Param ( "contactType" ) String contactType) ;
< select id = " listPage" resultType = " com.wanwei.sfc.user.modules.vo.customer.CustomerListVo" >
SELECT
*
FROM t_customer_info cust
where 1=1
</ select>