网站建设课程毕设,企业模板免费下载,云匠网怎么接单,租机网站开发Myatis和MybatisPlus常见分页方式
一、mybaits
原生limit分页 SELECT * FROM order_info limit #{pageNow},#{pageSize}分页插件#xff08;ssm中#xff0c;通过xml配置分页。springboot通过则通过配置文件#xff09;
PageHelper插件#xff1a;PageHelper.startPage(…Myatis和MybatisPlus常见分页方式
一、mybaits
原生limit分页 SELECT * FROM order_info limit #{pageNow},#{pageSize}
分页插件ssm中通过xml配置分页。springboot通过则通过配置文件
PageHelper插件PageHelper.startPage(pageNow,pageSize);ListOrderInfo orderInfoList orderInfoMapper.getOrderInfoList();PageInfoOrderInfo userPageInfo new PageInfo(orderInfoList);return userPageInfo.getList();
RowBounds进分页极少落地
二、MP分页
直接上分页插件配置
package com.ithuang.demo.config;import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;Configuration
public class MybatisPlusConfig {Beanpublic MybatisPlusInterceptor mybatisPlusInterceptor(){MybatisPlusInterceptor interceptor new MybatisPlusInterceptor();interceptor.addInnerInterceptor(new PaginationInnerInterceptor());return interceptor;}
}三、其他 mybatisplus可以和mybatis混合使用也即使用MP特性处理基础的增删改查、使用Mybatis实现复杂的自定义SQL。