mybatis逆向工程相关配置

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

xml配置文件

<?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>
    <properties resource="database.properties" />

    <classPathEntry
            location="${jdbc.location}"/>
    <context id="mySQL" targetRuntime="MyBatis3">
        <commentGenerator>
            <property name="suppressDate" value="true"/>
            <property name="suppressAllComments" value="true"/>
        </commentGenerator>

        <jdbcConnection driverClass="${jdbc.driver}"
                        connectionURL="${jdbc.url}" userId="${jdbc.username}"
                        password="${jdbc.password}">
        </jdbcConnection>

        <javaTypeResolver>
            <property name="forceBigDecimals" value="false"/>
        </javaTypeResolver>

        <!--生成实体的配置属性-->
        <javaModelGenerator targetPackage="com.spring.model"
                            targetProject=".\src\main\java">
            <property name="enableSubPackages" value="true"/>
            <property name="trimStrings" value="true"/>
        </javaModelGenerator>

        <!--mapper配置文件-->
        <sqlMapGenerator targetPackage="com.spring.dao.mapper"
                         targetProject=".\src\main\java">
            <property name="enableSubPackages" value="true"/>
        </sqlMapGenerator>

        <!--mapper接口-->
        <javaClientGenerator type="XMLMAPPER"
                             targetPackage="com.spring.dao.mapper"
                             targetProject=".\src\main\java">
            <property name="enableSubPackages" value="true"/>
        </javaClientGenerator>

        <table tableName="user_tb" domainObjectName="User"
               enableCountByExample="false"
               enableUpdateByExample="false"
               enableDeleteByExample="false"
               enableSelectByExample="false"
               selectByExampleQueryId="false"/>
        <!--表对应实体名称的配置-->
        <!--     <table tableName="plan"
                    enableCountByExample="false"
                    enableUpdateByExample="false"
                    enableDeleteByExample="false"
                    enableSelectByExample="false"
                    selectByExampleQueryId="false"/>-->
    </context>
</generatorConfiguration>

 



上一篇:Flask-Restful解决跨域问题No 'Access-Control-Allow-Origin' header is present on the requested res


下一篇:Api Generator Plus & Copy as curl 自动上传YApi接口