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

  • 相关阅读:
    AJAX异步传输——以php文件传输为例
    js控制json生成菜单——自制菜单(一)
    vs2010中关于HTML控件与服务器控件分别和js函数混合使用的问题
    SQL数据库连接到服务器出错——无法连接到XXX
    PHP错误:Namespace declaration statement has to be the very first statement in the script
    【LeetCode】19. Remove Nth Node From End of List
    【LeetCode】14. Longest Common Prefix
    【LeetCode】38. Count and Say
    【LeetCode】242. Valid Anagram
    【LeetCode】387. First Unique Character in a String
  • 原文地址:https://www.cnblogs.com/scorates/p/11214167.html
Copyright © 2011-2022 走看看