若依mybatis升级为mybatis-plus -- activiti工作流养成计划(二) - 简书

1.在根目录、common、system下都添加上以下依赖。原来的mabatis注释掉

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

            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.16.22</version>
            </dependency>

            <!-- pagehelper 分页插件 -->
            <dependency>
                <groupId>com.github.pagehelper</groupId>
                <artifactId>pagehelper-spring-boot-starter</artifactId>
                <version>${pagehelper.boot.version}</version>
            </dependency>

2.修改admin下的application,将原来mybatis的注释掉,改为下面的mybatis-plus

# MyBatis配置
#mybatis:
#    # 搜索指定包别名
#    typeAliasesPackage: com.ruoyi.**.domain
#    # 配置mapper的扫描,找到所有的mapper.xml映射文件
#    mapperLocations: classpath*:mapper/**/*Mapper.xml
#    # 加载全局的配置文件
#    configLocation: classpath:mybatis/mybatis-config.xml

mybatis-plus:
  mapper-locations: classpath*:mapper/**/*Mapper.xml
  type-aliases-package: com.ruoyi.**.domain
  global-config:
    db-config:
      id-type: auto
      field-strategy: 2
      refresh-mapper: true
      db-type: mysql
  configuration:
    map-underscore-to-camel-case: true
    cache-enabled: false
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

3.将此路径的这个文件内容全部注释掉

ruoyi-framework\src\main\java\com\ruoyi\framework\config\MyBatisConfig.java

Logo

快速构建 Web 应用程序

更多推荐