mybatis-generator.xml

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mybatis-generator.xml相关的知识,希望对你有一定的参考价值。

?????????target   int   begin   ntb   jdbc   run   utf-8   try   update   

<?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>
    <!--??????generator?????????????????????????????? call mvn mybatis-generator:generate -e -->
    <!-- ?????????????????? -->
    <properties resource="mybatis-generator/mybatisGeneratorinit.properties"/>
    <!--classPathEntry:????????????JDBC??????,?????????????????????????????? ?????? -->
    <!--<classPathEntry location="D:generator_mybatismysql-connector-java-5.1.24-bin.jar" /> -->

    <!-- ?????????????????????context -->
    <!--defaultModelType="flat" ??????????????????????????? -->
    <context id="MysqlTables" targetRuntime="MyBatis3Simple" defaultModelType="flat">
        <!-- ???????????????????????????????????????false??????????????????true?????????SqlReservedWords??????????????????????????????
        ???????????????????????????????????????????????????Java?????????????????????columnOverride?????? -->
        <property name="autoDelimitKeywords" value="true" />
        <!-- ?????????Java??????????????? -->
        <property name="javaFileEncoding" value="utf-8" />
        <!-- beginningDelimiter???endingDelimiter?????????????????????????????????????????????????????????????????????ORACLE??????????????????MYSQL?????????`???????????? -->
        <property name="beginningDelimiter" value="`" />
        <property name="endingDelimiter" value="`" />

        <!-- ?????????java?????? -->
        <property name="javaFormatter" value="org.mybatis.generator.api.dom.DefaultJavaFormatter"/>
        <!-- ?????????XML?????? -->
        <property name="xmlFormatter" value="org.mybatis.generator.api.dom.DefaultXmlFormatter"/>
        <plugin type="org.mybatis.generator.plugins.SerializablePlugin" />

        <plugin type="org.mybatis.generator.plugins.ToStringPlugin" />

        <!-- ?????? -->
        <commentGenerator >
            <property name="suppressAllComments" value="false"/><!-- ?????????????????? -->
            <property name="suppressDate" value="true" /> <!-- ??????????????????????????????-->
        </commentGenerator>

        <!-- jdbc?????? -->
        <jdbcConnection driverClass="${jdbc_driver}" connectionURL="${jdbc_url}" userId="${jdbc_user}" password="${jdbc_password}" />
        <!-- ???????????? -->
        <javaTypeResolver>
            <!-- ????????????bigDecimal??? false??????????????????????????????Long, Integer, Short, etc.??? -->
            <property name="forceBigDecimals" value="false"/>
        </javaTypeResolver>

        <!-- ????????????????????? -->
        <javaModelGenerator targetPackage="com.cuit.springboot.gentry" targetProject="${project}" >
            <property name="enableSubPackages" value="false"/>
            <property name="trimStrings" value="true"/>
        </javaModelGenerator>
        <!-- ??????mapxml?????? -->
        <sqlMapGenerator targetPackage="mappers" targetProject="${resources}" >
            <property name="enableSubPackages" value="false" />
        </sqlMapGenerator>
        <!-- ??????mapxml??????client??????????????????dao -->
        <javaClientGenerator targetPackage="com.cuit.springboot.gdao" targetProject="${project}" type="XMLMAPPER" >
            <property name="enableSubPackages" value="false" />
        </javaClientGenerator>
        <!-- table???????????????,??????????????????????????????????????????table???tableName??????????????????????????????,????????????tableName?????????????????????%????????????????????????????????????,?????????????????????????????????????????? -->
        <table tableName="user" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
            <property name="useActualColumnNames" value="false" />
            <!-- ?????????????????? -->
            <generatedKey column="id" sqlStatement="Mysql" identity="true" />
        </table>
    </context>
</generatorConfiguration>

 

以上是关于mybatis-generator.xml的主要内容,如果未能解决你的问题,请参考以下文章

修改表结构后,自动生成(mybatis-generator)时遇到的坑

报错generate on project XX resource xx.properties does not exist

逆向工程----MBG

idea下springBoot+mybatis的逆向工程

微信小程序代码片段

VSCode自定义代码片段——CSS选择器