mybatisplus的使用方法 一 (Springboot配置)
一、在pom.xml配置依赖
<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.3.1</version> </dependency>
二、在application.yml里配置xml 位置
# 配置mapper xml的位置 mybatis: mapper-locations: classpath*:mapper/*.xml
三、新建MyBatisPlusPageConfig配置mybatisplus翻页
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * @author: Gavin * @created: 2023/4/12 00:02 * @description: **/ @Configuration @ConditionalOnClass(value = {PaginationInterceptor.class}) public class MyBatisPlusPageConfig { @Bean public PaginationInterceptor paginationInterceptor() { return new PaginationInterceptor(); } }
MybatisPlus官网:https://www.baomidou.com/