The generatorConfig configuration file of MyBatis automatically generated code and its detailed interpretation

<?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>  
  
    <!-- Import configuration file-->  
    <properties resource="jdbc.properties"/>  
      
    <!-- Specify the data connection driver jar address-->  
    <classPathEntry location="C:\Users\Administrator\.m2\repository\mysql\mysql-connector-java\5.1.30\mysql-connector-java-5.1.30.jar" />  
      
    <!-- One database one context -->  
    <context id="FCRMTables">  
        <!-- Comments-->  
        <commentGenerator >  
            <property name="suppressAllComments" value="true"/><!-- Whether to uncomment -->  
            <property name="suppressDate" value="true" /> <!-- Whether to generate a timestamp for comment generation-->  
        </commentGenerator>  
          
        <!-- jdbc connection-->  
        <jdbcConnection driverClass="${driverClassName}"  
            connectionURL="${url}" userId="${username}"  
            password="${password}" />  
          
        <!-- type conversion -->  
        <javaTypeResolver>  
            <!-- Whether to use bigDecimal, false can automatically convert the following types (Long, Integer, Short, etc.) -->  
            <property name="forceBigDecimals" value="false"/>  
        </javaTypeResolver>  
          
        <!-- Generate the package name and location of the entity class Note that the value of targetProject is the relative path of the entity class in the specific location of the project, -->  
        <javaModelGenerator targetPackage="com.qlm.entity"  
            targetProject="src/main/java" >  
            <!-- Whether to add a new layer of schema under the current path, eg: false path com.oop.eksp.user.model, true: com.oop.eksp.user.model.[schemaName] -->  
            <property name="enableSubPackages" value="true"/>  
            <!-- Whether to make a trim call for string type fields when set -->  
            <property name="trimStrings" value="true"/>  
        </javaModelGenerator>  
          
        <!-- Generated SQLMapper mapping file package name and location-->  
        <sqlMapGenerator targetPackage="mybatisMapper"  
            targetProject="src/main/resources" >  
            <!-- Whether to add a new layer of schema under the current path, eg: false path com.oop.eksp.user.model, true: com.oop.eksp.user.model.[schemaName] -->  
            <property name="enableSubPackages" value="true" />  
        </sqlMapGenerator>  
          
        <!-- The package name and location of the generated DAO, this configuration places the generated dao class under the package me.gacl.dao -->  
        <javaClientGenerator targetPackage="com.qlm.dao"  
            targetProject="src/main/java" type="XMLMAPPER" >  
            <!-- Whether to add a new layer of schema under the current path, eg: false path com.oop.eksp.user.model, true: com.oop.eksp.user.model.[schemaName] -->  
            <property name="enableSubPackages" value="true" />  
        </javaClientGenerator>  
          
        <!-- Configuration table information-->  
        <!-- schema is the database name tableName is the corresponding database table domainObjectName is the entity class to be generated enable*ByExample   
                Whether to generate example class -->    
        <!-- Just change tableName and domainObjectName -->  
        <table schema="qlm" tableName="tb_qlm_admin"  
            domainObjectName="Admin" enableCountByExample="false"  
            enableDeleteByExample="false" enableSelectByExample="false"  
            enableUpdateByExample="false">             
        </table>  
    </context>  
</generatorConfiguration>  

  

The jdbc.properties file is as follows

driverClassName=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/qlm?autoReconnect=true&useUnicode=true&characterEncoding=utf-8
username=root
password=root

  

Run -->Run As -->Maven build-->Goals fill in mybatis-generator:generate--Run and then generate the corresponding code

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324954496&siteId=291194637