• 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

  • 相关阅读:
    C# 中国日历 农历 阳历 星座 二十四节气 二十八星宿 节日 天干地支
    C# AutoMapper:流行的对象映射框架,可减少大量硬编码,很小巧灵活,性能表现也可接受。
    Asp.net webapi 判断请求参数是否为空简易方法 Model Validation 判断请求参数是否为空
    IIS本地部署局域网可随时访问的项目+mysql可局域网内访问
    jquery ajax return不起作用
    asp.net webapi 给字段赋初始值DefaultValue 解决前端传空字符串后台接受不是“”而是NULL
    git log的常用命令
    C++面试题集合(持续更新)
    python的with用法(转载)
    stage_ros的world文件配置方法
  • 原文地址:https://www.cnblogs.com/scorates/p/11214167.html
Copyright © 2020-2023  润新知