Generator 使用

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiewendong93/article/details/54315419

Generator

图例 1:generatorConfig.xml

这里写图片描述

图例 2:Pom.xml

这里写图片描述

图例3:如何运行

这里写图片描述

代码:

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>generator</groupId>
    <artifactId>generator</artifactId>
    <version>1.0-SNAPSHOT</version>
    <build>
        <finalName>xxx</finalName>
        <plugins>
            <plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.2</version>
                <configuration>
                    <verbose>true</verbose>
                    <overwrite>true</overwrite>
                    <!--配置文件的路径-->
                    <configurationFile>
                      ${basedir}/src/main/resources/generatorConfig.xml
                    </configurationFile>
                    <overwrite>true</overwrite>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

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="C:/Users/clps/Desktop/MUSWEB/web/WEB-INF/lib/ojdbc6.jar"/>
    <context id="my" targetRuntime="MyBatis3">
         <commentGenerator>
             <property name="suppressDate" value="false"/>
             <property name="suppressAllComments" value="true"/>
         </commentGenerator>

         <jdbcConnection 
            driverClass="oracle.jdbc.driver.OracleDriver"
            connectionURL="jdbc:oracle:thin:@127.0.0.1:1521:orcl" 
            userId="xiewendong"
            password="123456"/>
         <javaModelGenerator 
            targetPackage="com.hywin.model"
            targetProject="D:\\***\\Hywin\\POC\\src\\main\\java">
             <property name="enableSubPackages" value="true"/>
             <property name="trimStrings" value="true"/>
         </javaModelGenerator>

         <sqlMapGenerator 
             targetPackage="com.hywin.mapping"
             targetProject="D:\\***\\Hywin\\POC\\src\\main\\java">
             <property name="enableSubPackages" value="true"/>
         </sqlMapGenerator>

         <javaClientGenerator 
             targetPackage="com.hywin.dao"
             targetProject="D:\\***\\Hywin\\POC\\src\\main\\java" type="XMLMAPPER">
             <property name="enableSubPackages" value="true"/>
         </javaClientGenerator>
        <table tableName="ASHAREESOPTRADINGINFO"
               enableCountByExample="false" enableUpdateByExample="false"
               enableDeleteByExample="false" enableSelectByExample="false"
               selectByExampleQueryId="false">
        </table>
     </context>
 </generatorConfiguration>

猜你喜欢

转载自blog.csdn.net/xiewendong93/article/details/54315419
今日推荐