芯が強い人になるESTJ-A

# xml,三剑客,1注解方法2xml纯手写,3generator4mybatis-plus

IT開発 Tags: 无标签 阅读: 264

mybatis-generator
https://blog.mybatis.org/p/products.html

mybatis头文件

https://mybatis.org/mybatis-3/zh/getting-started.html

mybatis--generator踩坑完毕完,顺序问题,重复生成问题,注释太多问题。都解决了
<?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>
    <classPathEntry location="/Users/xuwen/desktop/springboot/xuwen-mallproject/mysql-connector-java-5.1.6.jar" />
    <context id="DB2Tables" targetRuntime="MyBatis3">
        <!--        注意顺序,否则报错-->
        <!--        不再追加xml内容-->
        <plugin type="org.mybatis.generator.plugins.UnmergeableXmlMappersPlugin" />
        <commentGenerator>
            <property name="suppressAllComments" value="true"/>
        </commentGenerator>

        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
                        connectionURL="jdbc:mysql://rm-uf6t9m0yx22dxrya5no.mysql.rds.aliyuncs.com:3306/mall?characterEncoding=UTF8"
                        userId="mall"
                        password="passMall123">
        </jdbcConnection>
        <javaTypeResolver >
            <property name="forceBigDecimals" value="false" />
        </javaTypeResolver>
        <javaModelGenerator targetPackage="com.xuwen.javamall.pojo" targetProject="src/main/java">
            <property name="enableSubPackages" value="true" />
            <!--            <property name="trimStrings" value="true" />-->
        </javaModelGenerator>

        <sqlMapGenerator targetPackage="mappers"  targetProject="src/main/resources">
            <property name="enableSubPackages" value="true" />
        </sqlMapGenerator>

        <javaClientGenerator type="XMLMAPPER" targetPackage="com.xuwen.javamall.dao"  targetProject="src/main/java">
            <property name="enableSubPackages" value="true" />
        </javaClientGenerator>

        <table tableName="mall_order" domainObjectName="Order" enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="false" enableUpdateByExample="false"/>
        <table tableName="mall_order_item" domainObjectName="OrderItem" enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="false" enableUpdateByExample="false"/>


    </context>


</generatorConfiguration>