mybatis.generator.plugins生成基础类

<?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>

    <context id="test" targetRuntime="MyBatis3">

        <!-- 实体类重命名规则:尾部统一添加Entity -->
        <!--<property name="domainObjectNameSuffix" value="Entity"/>-->
        <!--<property name="domainObjectNameSuffixExcludeTables" value=""/>-->

        <!--<plugin type="org.mybatis.generator.plugins.EqualsHashCodePlugin"/>-->
        <plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>
        <!--<plugin type="org.mybatis.generator.plugins.ToStringPlugin"/>-->

        <commentGenerator>
            <!-- 这个元素用来去除指定生成的注释中是否包含生成的日期 false:表示保护 -->
            <!-- 如果生成日期,会造成即使修改一个字段,整个实体类所有属性都会发生变化,不利于版本控制,所以设置为true -->
            <property name="suppressDate" value="true"/>
            <!-- 是否去除自动生成的注释 true:是 : false:否 -->
            <property name="suppressAllComments" value="true"/>
        </commentGenerator>

        <!--数据库链接URL,用户名、密码 -->
        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
                        connectionURL="jdbc:mysql://xxxxx:3306/xx?useUnicode=true&amp;characterEncoding=UTF-8&amp;zeroDateTimeBehavior=convertToNull"
                        userId="xxxx" password="xxxxx">
        </jdbcConnection>

        <javaTypeResolver>
            <!-- This property is used to specify whether MyBatis Generator should
                force the use of java.math.BigDecimal for DECIMAL and NUMERIC fields, -->
            <property name="forceBigDecimals" value="false"/>
        </javaTypeResolver>

        <!-- 实体类生成的位置 -->
        <javaModelGenerator targetPackage="com.xxxx.model" targetProject="../xxx-model/src/main/java">
            <property name="enableSubPackages" value="true"/>
            <property name="trimStrings" value="true"/>
        </javaModelGenerator>

        <!-- *Mapper.xml 文件的位置 -->
        <sqlMapGenerator targetPackage="com.xxxx.mapper"
                         targetProject="../ydq-dao/src/main/java">
            <property name="enableSubPackages" value="true"/>
        </sqlMapGenerator>

        <!-- dao 接口文件的位置 -->
        <javaClientGenerator targetPackage="com.xxxxx.dao"
                             targetProject="../xxxx/src/main/java" type="XMLMAPPER">
            <property name="enableSubPackages" value="true"/>
        </javaClientGenerator>

        <!-- 相关表的配置 -->
        <!--<table tableName="xxxxxx"-->
               <!--enableCountByExample="true" enableDeleteByExample="false"-->
               <!--enableSelectByExample="true" enableUpdateByExample="true">-->
            <!--<generatedKey column="ID" sqlStatement="JDBC" identity="true"/>-->
            <!--<columnOverride column="status" jdbcType="INTEGER" javaType="java.lang.Integer"/>-->
        <!--</table>-->
        <!--<table tableName="xxxxxx"-->
               <!--enableCountByExample="true" enableDeleteByExample="false"-->
               <!--enableSelectByExample="true" enableUpdateByExample="true">-->
            <!--<generatedKey column="ID" sqlStatement="JDBC" identity="true"/>-->
        <!--</table>-->
        <table tableName="xxxxxx"
        enableCountByExample="true" enableDeleteByExample="false"
        enableSelectByExample="true" enableUpdateByExample="true">
        <generatedKey column="ID" sqlStatement="JDBC" identity="true"/>
        </table>

    </context>
</generatorConfiguration>
人这辈子没法做太多事情,所以每做一件事都要做到精彩绝伦。 因为,这就是我的宿命。人生苦短,你明白吗? 所以这是我为人生做出的选择
原文地址:https://www.cnblogs.com/junjun1578/p/15719296.html