<!-- 3.配置SqlSessionFactory对象 -->
<bean id="sqlSessionFactory" class="com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean">
<!-- 注入数据库连接池 -->
<property name="dataSource" ref="dataSource"/>
<!-- 扫描entity包 使用别名 -->
<property name="typeAliasesPackage" value="com.yhy.mp.bean"/>
<property name="globalConfig" ref="globalConfig"></property>
<property name="plugins">
<array>
<!-- 分页插件配置 -->
<bean class="com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor">
</bean>
</array>
</property>
</bean>
Page<Employee> employeePage = employeeMapper.selectPage(new Page<Employee>(1, 2),
new QueryWrapper<Employee>().between("age", 18, 50).
eq("gender", 0).
eq("last_name", "fuck")
);
List<Employee> records = employeePage.getRecords();
这样分页显示的结果才有效果,不然不配置就不会分页,2.X是在内存中自动有了
看https://blog.csdn.net/qq_39809458/article/details/90667544