mybatis項目升級到mybatis-plus項目


1.注釋mybatis-starter

添加 mybatis-plus

```  <dependency>
<dependency>
    <groupId>com.baomidou</groupId>
    <artifactId>mybatis-plus-boot-starter</artifactId>
    <version>3.3.2</version>
</dependency>
```

2.配置文件mybatis修改為mybatis-puls

mybatis-puls:
  mapper-locations:
    - classpath*:com/**/mapper/*.xml
    - classpath*:mapper/*.xml

3.添加MybatisPlusConfig配置文件

@Configuration
@MapperScan(basePackages = {"com.xxxx.xxxx.mapper"})
@EnableTransactionManagement
public class MybatisPlusConfig {
    /**
     * 性能分析攔截器,不建議生產使用
     */
//    @Bean
//    public PerformanceInterceptor performanceInterceptor(){
//        return new PerformanceInterceptor();
//    }

    /**
     * 分頁插件
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }

    /**
     * pagehelper的分頁插件
     */
    @Bean
    public PageInterceptor pageInterceptor() {
        return new PageInterceptor();
    }

}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM