Add in Maven
<plugin> <groupId>Org.mybatis.generator</groupId> <Artifactid>Mybatis-generator-maven-plugin</Artifactid> <version>1.3.5</version> <Configuration> <verbose>True</verbose> <Overwrite>True</Overwrite> </Configuration> </plugin>
Resource folder Configuration Generator.xml
<?XML version= "1.0" encoding= "UTF-8"?><!DOCTYPE generatorconfiguration Public "-//mybatis.org//dtd mybatis Generator Configuration 1.0//en" "Htt P://mybatis.org/dtd/mybatis-generator-config_1_0.dtd "><generatorconfiguration> <PropertiesResource= "Application.yml" /> <!--MySQL-driven location - <Classpathentry Location= "/users/xx/.m2/repository/mysql/mysql-connector-java/8.0.11/mysql-connector-java-8.0.11.jar" /> <ContextID= "Tables"Targetruntime= "MyBatis3"> <!--Notes - <Commentgenerator> <!--whether to generate an annotation generation timestamp - < Propertyname= "Suppressdate"value= "true"/> <!--whether to remove automatically generated comments true: Yes: false: No - < Propertyname= "Suppressallcomments"value= "true"/> </Commentgenerator> <!--JDBC Connection - <jdbcconnectionDriverclass= "Com.mysql.jdbc.Driver"Connectionurl= "Jdbc:mysql://localhost:3306/user"userId= "root"Password= "root"> </jdbcconnection> <!--non-mandatory, type-processor, conversion control between database type and Java type - <!--by default, the JDBC decimal and NUMERIC types are parsed to Integer, and the JDBC decimal and NUMERIC types are resolved to Java.math.BigDecimal if True - <Javatyperesolver> <!--whether to use BigDecimal, false to automatically convert the following types (Long, Integer, short, etc.) - < Propertyname= "Forcebigdecimals"value= "false" /> </Javatyperesolver> <!--generate entity class address - <JavamodelgeneratorTargetpackage= "Com.heart.count.domain"Targetproject= "Src/main/java"> <!--The space returned from the database before and after the value is cleaned - < Propertyname= "Trimstrings"value= "true" /> <!--enablesubpackages: Do you want the schema to be the suffix of the package - < Propertyname= "Enablesubpackages"value= "false" /> </Javamodelgenerator> <!--Generate mapper XML file - <SqlmapgeneratorTargetpackage= "Com.heart.count.xml"Targetproject= "Src/main/java"> <!--enablesubpackages: Do you want the schema to be the suffix of the package - < Propertyname= "Enablesubpackages"value= "false" /> </Sqlmapgenerator> <!--generate mapper XML corresponding to the client - <JavaclientgeneratorTargetpackage= "Com.heart.count.mapper"Targetproject= "Src/main/java"type= "Xmlmapper"> <!--enablesubpackages: Do you want the schema to be the suffix of the package - < Propertyname= "Enablesubpackages"value= "false" /> </Javaclientgenerator> <!--Configure table Information - <!--schema is the database name tablename to the corresponding database table Domainobjectname is the entity class to be generated enable*byexample whether to generate example class - <TableSchema= "User"TableName= "Heartcount"Domainobjectname= "Heartcount"Enablecountbyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Enableupdatebyexample= "false"> </Table> </Context></generatorconfiguration>
Maven executes plugins to generate the corresponding file
Springboot+mybatis Generator