zoukankan      html  css  js  c++  java
  • mybatis逆向工程mvn插件

    pom.xml

          <plugins>
            <!-- Tomcat插件 -->
            <plugin>
              <groupId>org.apache.tomcat.maven</groupId>
              <artifactId>tomcat7-maven-plugin</artifactId>
              <version>2.2</version>
              <configuration>
                <port>80</port>
                <path>/</path>
                <uriEncoding>UTF-8</uriEncoding>
              </configuration>
            </plugin>
              <!-- https://mvnrepository.com/artifact/org.mybatis.generator/mybatis-generator-maven-plugin -->
            <plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.5</version>
            </plugin>
              
          </plugins>

    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>
        <!--数据库驱动jar -->
        <classPathEntry location="C:SoftDatamaven
    epositorymysqlmysql-connector-java5.1.44mysql-connector-java-5.1.44.jar" />
    
        <!--<context id="DB2Tables" targetRuntime="Ibatis2Java5">-->
        <context id="myConfig" targetRuntime="Mybatis3">
            <!--去除注释 (true好像不起作用) -->
            <commentGenerator>
                <property name="suppressAllComments" value="true" />
            </commentGenerator>
    
            <!--数据库连接 -->
            <jdbcConnection driverClass="com.mysql.jdbc.Driver"
                            connectionURL="jdbc:mysql://localhost:3306/aaos_platform_zjkb"
                            userId="root"
                            password="root123">
            </jdbcConnection>
    
            <!--生成Dao文件 可以配置 type="XMLMAPPER"生成xml的dao实现  context id="DB2Tables" 修改targetRuntime="MyBatis3"  -->
            <!--<javaClientGenerator type="SPRING" targetPackage="com.project.aaos.dao"  targetProject="D:Minecode">
                <property name="enableSubPackages" value="false" />
            </javaClientGenerator>-->
            <javaClientGenerator type="XMLMAPPER" targetPackage="com.project.aaos.dao"  targetProject="D:	emp"/>
    
            <!--默认false
               Java type resolver will always use java.math.BigDecimal if the database column is of type DECIMAL or NUMERIC.
             -->
            <javaTypeResolver >
                <property name="forceBigDecimals" value="false" />
            </javaTypeResolver>
    
    
            <!--生成实体类 指定包名 以及生成的地址 (可以自定义地址,但是路径不存在不会自动创建  使用Maven生成在target目录下,会自动创建) -->
            <javaModelGenerator targetPackage="com.project.aaos.pojo" targetProject="D:	emp">
                <property name="enableSubPackages" value="false" />
                <property name="trimStrings" value="true" />
            </javaModelGenerator>
            <!--生成SQLMAP文件 -->
            <sqlMapGenerator targetPackage="com.project.aaos.dao"  targetProject="D:	emp">
                <property name="enableSubPackages" value="false" />
            </sqlMapGenerator>
    
    
    
            <!--对应数据库表 mysql可以加入主键自增 字段命名 忽略某字段等-->
            <table schema="aaos_platform_zjkb" tableName="appro_file" domainObjectName="ApproFileInfo"  enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" >
                <property name="useActualColumnNames" value="true" />
            </table>
            <!--<table schema="aaos_platform_zjkb"  tableName="appro_line" domainObjectName="ApproLineInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" >
                <property name="useActualColumnNames" value="true" />
            </table>-->
        </context>
    </generatorConfiguration>

    命令

    mvn  mybatis-generator:generate

  • 相关阅读:
    POJ 2723 Get Luffy Out(2-SAT)
    ZOJ 3613 Wormhole Transport
    HDU 4085 Peach Blossom Spring
    NBUT 1221 Intermediary
    NBUT 1223 Friends number
    NBUT 1220 SPY
    NBUT 1218 You are my brother
    PAT 1131. Subway Map (30)
    ZSTU OJ 4273 玩具
    ZSTU OJ 4272 最佳淘汰算法
  • 原文地址:https://www.cnblogs.com/scorates/p/11214167.html
Copyright © 2011-2022 走看看