• 【Mybatis】Mybatis generator的使用


    pom.xml

            <plugin>
                    <groupId>org.mybatis.generator</groupId>
                    <artifactId>mybatis-generator-maven-plugin</artifactId>
                    <version>1.3.2</version>
                    <configuration>
                        <configurationFile>src/main/resources/generator/generatorConfig.xml</configurationFile>
                        <verbose>true</verbose>
                        <overwrite>true</overwrite>
                    </configuration>
                    <executions>
                        <execution>
                            <id>Generate MyBatis Artifacts</id>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>org.mybatis.generator</groupId>
                            <artifactId>mybatis-generator-core</artifactId>
                            <version>1.3.2</version>
                        </dependency>
                        <dependency>
                            <groupId>tk.mybatis</groupId>
                            <artifactId>mapper</artifactId>
                            <version>3.3.9</version>
                        </dependency>
                    </dependencies>
                </plugin>

    generatorConfig.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>
        <!-- <classPathEntry location="E:mysql-connector-java-5.1.25.jar"/>-->
        <classPathEntry location="E:ojdbc6.jar"/>
        <!--  location="F:MavenRepositorymysqlmysql-connector-java5.1.37mysql-connector-java-5.1.37.jar"/>-->
        <context id="MysqlContext" targetRuntime="MyBatis3Simple" defaultModelType="flat">
    
    
            <property name="beginningDelimiter" value="`"/>
            <property name="endingDelimiter" value="`"/>
            <plugin type="tk.mybatis.mapper.generator.MapperPlugin">
                <property name="mappers" value="tk.mybatis.mapper.common.Mapper"/>
            </plugin>
            <!-- <jdbcConnection driverClass="com.mysql.jdbc.Driver"
                             connectionURL="jdbc:mysql://192.168.18.7:3306/hd_ship_cloud?characterEncoding=utf8"
                             userId="root"
                             password="root">
             </jdbcConnection>-->
            <commentGenerator>
                <property name="suppressAllComments" value="false" />
            </commentGenerator>
    
            <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
                            connectionURL="jdbc:oracle:thin:@192.168.18.2:1521:orcl"
                            userId="shiptracker_smart"
                            password="ok">
            </jdbcConnection>
    
            <javaModelGenerator targetPackage="entitytemp" targetProject="srcmain
    esources">
                <property name="trimStrings" value="true"/>
            </javaModelGenerator>
    
            <sqlMapGenerator targetPackage="mapper" targetProject="srcmain
    esources"/>
    
            <!--<javaClientGenerator type="XMLMAPPER" targetPackage="net.huadong.mapper" targetProject="srcmainjava"/>-->
    
            <table tableName="system_resources" domainObjectName="SystemResources"
                   enableCountByExample="false" enableUpdateByExample="false"
                   enableDeleteByExample="false" enableSelectByExample="false"
                   selectByExampleQueryId="false"/>
            <table tableName="system_role_resources" domainObjectName="SystemRoleResources"
                   enableCountByExample="false" enableUpdateByExample="false"
                   enableDeleteByExample="false" enableSelectByExample="false"
                   selectByExampleQueryId="false"/>
            <table tableName="system_user" domainObjectName="SystemUser"
                   enableCountByExample="false" enableUpdateByExample="false"
                   enableDeleteByExample="false" enableSelectByExample="false"
                   selectByExampleQueryId="false"/>
            <table tableName="system_role" domainObjectName="SystemRole"
                   enableCountByExample="false" enableUpdateByExample="false"
                   enableDeleteByExample="false" enableSelectByExample="false"
                   selectByExampleQueryId="false"/>
            <table tableName="system_user_role" domainObjectName="SystemUserRole"
                   enableCountByExample="false" enableUpdateByExample="false"
                   enableDeleteByExample="false" enableSelectByExample="false"
                   selectByExampleQueryId="false"/>
            <!--<table tableName="%">-->
            <!--<generatedKey column="id" sqlStatement="Oracle"/>-->
            <!--</table>-->
        </context>
    </generatorConfiguration>
  • 相关阅读:
    matlab cell
    matlab linux 快捷键设置——有问题还是要解决
    latex 小结
    TOJ 1258 Very Simple Counting
    TOJ 2888 Pearls
    HDU 1248 寒冰王座
    TOJ 3486 Divisibility
    TOJ 3635 过山车
    TOJ 1840 Jack Straws
    HDU 4460 Friend Chains
  • 原文地址:https://www.cnblogs.com/CESC4/p/7365364.html
Copyright © 2020-2023  润新知