Mybatis-generator generates XML with multiple resultMap problems

use

Download the mybatis-generater-demo project and configure the generatorConfig file. Generate pojo, xml, mapper.

After successful generation, copy the corresponding file to the correct project location. Add project dependencies

<!-- 通用mapper逆向工具 -->
        <dependency>
            <groupId>tk.mybatis</groupId>
            <artifactId>mapper-spring-boot-starter</artifactId>
            <version>2.1.5</version>
        </dependency>

Some problems with MySQL8

  1. Modify the database driver com.mysql.cj.jdbc.Driver
  2. The link address should add the time zone jdbc:mysql://localhost:3306/foodie-shop-dev?serverTimezone=UTC
  3. Modify the driver version 8.0.20 in the pom
  4. There is a table with the same name, which causes multiple resultMaps to be generated in the XML file. Add the nullCatalogMeansCurrent attribute.
        <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
                        connectionURL="jdbc:mysql://localhost:3306/foodie_dev?serverTimezone=UTC"
                        userId="root"
                        password="123456">
            <property name="nullCatalogMeansCurrent" value="true" />
        </jdbcConnection>

Guess you like

Origin blog.csdn.net/LIZHONGPING00/article/details/106982065