依赖:

        <dependency>
            <groupId>org.mybatis.generator</groupId>
            <artifactId>mybatis-generator-core</artifactId>
            <version>1.3.7</version>
        </dependency>

插件:

            <plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.7</version>
                <configuration>
                    <configurationFile>${basedir}/src/main/resources/generatorConfig.xml
                    </configurationFile>
                    <overwrite>true</overwrite>
                    <verbose>true</verbose>
                </configuration>
            </plugin>

文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
    <classPathEntry location="D:\maven\mavenRepository\mysql\mysql-connector-java\8.0.29\mysql-connector-java-8.0.29.jar" />
    <context id="mysql" targetRuntime="MyBatis3">
        <plugin type="org.mybatis.generator.plugins.UnmergeableXmlMappersPlugin" />
        <commentGenerator>
            <property name= "suppressDate" value= "true" />
            <property name= "suppressAllComments" value= "true" />
        </commentGenerator>
        <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
                        connectionURL="jdbc:mysql://localhost:3306/"
                        userId="root"
                        password="123456">
            <property name="useInformationSchema" value="true"/>
        </jdbcConnection>
        <javaModelGenerator targetPackage="com..mapper.entity" targetProject="src/main/java"/>
        <sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources"/>
        <javaClientGenerator type="XMLMAPPER" targetPackage="com..mapper" targetProject="src/main/java" />
        <table
                tableName = ""
                domainObjectName = "DO"
                enableUpdateByPrimaryKey="true"
                enableInsert="true"
                enableSelectByExample="true">
            <!--<generatedKey column="login_id" sqlStatement="JDBC" identity="true"/>-->
            <!--<columnOverride column="week" javaType="java.lang.Integer[]"/>-->
        </table>
    </context>
</generatorConfiguration>