Springboot+mybatis Generator

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.