- 前言
- 引入插件
- 配置
- 添加扫描
- 使用
- 分页
MyBatis-Plus (opens new window)(简称 MP)是一个MyBatis (opens new window)的增强工具,在 MyBatis 的基础上只做增强不做改变,为简化开发、提高效率而生
苞米豆官网
引入插件配置com.baomidou mybatis-plus-boot-starter mybatis-plus-latest-version
在 application.yml 配置文件中添加 数据库的相关配置:
# DataSource Config
spring:
datasource:
driver-class-name: org.h2.Driver
schema: classpath:db/schema-h2.sql
data: classpath:db/data-h2.sql
url: jdbc:h2:mem:test
username: root
password: test
mybatis-plus.mapper-locations= classpath*:com/baomidoudal/mapper
public LambdaQueryWrapper() {
this((T) null);
}
中文案例源码写的很清楚,全中文
如果需要配置多数据源和逆向生成,以及page可以参考文档使用即可
指的说一下就是关于page分页
分页
public IPage selectAOrderListByPage(OrderQueryListBO OrderQueryListBO) {
IPage orderDOIPage = new Page<>(orderQueryListBO.getPage().getPageNo(), orderQueryListBO.getPage().getLimit());
QueryWrapper queryWrapper = getorderDOQueryWrapper(orderQueryListBO);
return orderMapper.selectPage(orderDOIPage, queryWrapper);



