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>
  • 相关阅读:
    LVS基于DR模式负载均衡的配置
    Linux源码安装mysql 5.6.12 (cmake编译)
    HOSt ip is not allowed to connect to this MySql server
    zoj 3229 Shoot the Bullet(无源汇上下界最大流)
    hdu 3987 Harry Potter and the Forbidden Forest 求割边最少的最小割
    poj 2391 Ombrophobic Bovines(最大流+floyd+二分)
    URAL 1430 Crime and Punishment
    hdu 2048 神、上帝以及老天爷(错排)
    hdu 3367 Pseudoforest(最大生成树)
    FOJ 1683 纪念SlingShot(矩阵快速幂)
  • 原文地址:https://www.cnblogs.com/CESC4/p/7365364.html
Copyright © 2011-2022 走看看