zoukankan      html  css  js  c++  java
  • 【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>
  • 相关阅读:
    Linux之流程判断
    Linux之Shell变量
    Linux之RAID
    Y-Sport
    [ST2017] Lab1: Triangle type and Junit test
    [ST2017] Hw3: Prime Path
    [ST2017] Hw2: Fault, Error, Failure and test case for projects
    [SPM2017] Hw1: The outcome of my project [Deadline: 23:59:59, Mar.1, 2017]
    [ST2017] Hw1: An error from my past projects [Deadline: 23:59:59, Feb.27, 2017]
    一个使用Jmeter做接口性能测试的实战案例
  • 原文地址:https://www.cnblogs.com/CESC4/p/7365364.html
Copyright © 2011-2022 走看看