<?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>
<!--这里是connector的jar所在的绝对路径-->
<classPathEntry
location="/Users/zhenghao/.m2/repository/mysql/mysql-connector-java/5.1.39/mysql-connector-java-5.1.39.jar"/> <!--id 必填, defaultModelType是Model的类型,flat不会产生Example,Key,WithBLOB等-->
<context id="my" defaultModelType="flat" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressDate" value="false"/>
<property name="suppressAllComments" value="true"/>
</commentGenerator> <!--数据库连接串-->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/oms?useSSL=false"
userId="root"
password="1100131943"/> <!--models-->
<javaModelGenerator targetPackage="com.rxhui.oms.core.domain"
targetProject="/Users/zhenghao/git/quant-oms/core/src/main/java">
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator> <!--xmlMappers-->
<sqlMapGenerator targetPackage="mappers"
targetProject="/Users/zhenghao/git/quant-oms/core/src/main/resources">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator> <!--DAO-->
<javaClientGenerator targetPackage="com.rxhui.oms.core.dao"
targetProject="/Users/zhenghao/git/quant-oms/core/src/main/java" type="XMLMAPPER">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator> <!--<table tableName="T_FEE_AGTBILL" domainObjectName="FeeAgentBill"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"/>--> <table tableName="orderEntrust" domainObjectName="OrderEntrust"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false">
<!--<columnRenamingRule searchString="^D_"
replaceString=""/>-->
</table> <table tableName="orderCancel" domainObjectName="OrderCancel"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false">
<!--<columnRenamingRule searchString="^D_"
replaceString=""/>-->
</table> <table tableName="dealPush" domainObjectName="DealPush"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false">
<!--<columnRenamingRule searchString="^D_"
replaceString=""/>-->
</table> </context>
</generatorConfiguration>

如果使用maven,

<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>${mybatis-generator}</version>
<configuration>
<configurationFile>src/main/resources/mybatis-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>${mybatis-generator}</version>
</dependency>
</dependencies>
</plugin>

另外,生成的mapper.xml中,insert如果有默认值(如自增序列或创建时间等),需要使用insertSelective才能正确插入默认值。

mybatis generator 用法的更多相关文章

  1. mybatis generator的用法

    1 自动生成代码 配置数据库 自动生成三个文件: 第一,java bean文件: 第二,java bean对应的dao文件,但是这里的dao只是一个接口: 第三,mybatis需要的Mapper文件: ...

  2. MyBatis Generator 详解

    MyBatis Generator中文文档 MyBatis Generator中文文档地址:http://mbg.cndocs.tk/ 该中文文档由于尽可能和原文内容一致,所以有些地方如果不熟悉,看中 ...

  3. MyBatis Generator 详解 【转来纯为备忘】

    版权声明:版权归博主所有,转载请带上本文链接!联系方式:abel533@gmail.com   目录(?)[+] MyBatis Generator中文文档 运行MyBatis Generator X ...

  4. mybatis Generator配置文件详解

    这里按照配置的顺序对配置逐个讲解,更细的内容可以配合中文文档参照. 1. 配置文件头 <?xml version="1.0" encoding="UTF-8&quo ...

  5. mybatis.generator.configurationFile

    mybatis.generator.configurationFile 有一个更好的配置方法,可以不用在generateConfig.xml里面写死驱动的地址:如果你的mybatis连接也是在pom. ...

  6. Mybatis基本用法--下

    Mybatis基本用法--下 第七部分 mybatis-spring-boot-starter 官网:http://www.mybatis.org/spring-boot-starter/mybati ...

  7. MyBatis Generator中文文档

    MyBatis Generator中文文档 MyBatis Generator中文文档地址: http://mbg.cndocs.tk/ 该中文文档由于尽可能和原文内容一致,所以有些地方如果不熟悉,看 ...

  8. MyBatis Generator 详解(转)

    MyBatis Generator中文文档 MyBatis Generator中文文档地址:http://mbg.cndocs.tk/ 该中文文档由于尽可能和原文内容一致,所以有些地方如果不熟悉,看中 ...

  9. MyBatis Generator 详解 专题

    idea中有plugin可提高效率: http://www.henryxi.com/use-idea-mybatis-plugin-generate-mapper-files eg: <?xml ...

随机推荐

  1. activity状态的保存和恢复

    activity状态的保存和恢复 一.简介 1.保存activity状态 * 保存activity状态,onSaveInstanceState这个方法会自动保存有ID的组件的状态 * 没有ID的组件或 ...

  2. 解决socket负载均衡集群方案和代码实现

    有一段时间,在考虑下socket 之间集群 可以在Nginx 下可以 但是不同服务器之间怎么通讯呢 后来自己也想可不可以用什么东西或者中间件来通讯 ,后来在百度之下 发现果然就是按照我所想的 ,在网上 ...

  3. java Graphics2d消除锯齿,使字体平滑显示

    Java 2D API 提供的文本处理功能进行美化.Java 2D API 的文本功能包括: 使用抗锯齿处理和微调(hinting)以达到更好的输出质量 可以使用系统安装的所有字体 可以将对图形对象的 ...

  4. redis、kafka、rabittMQ对比 (转)

    本文不对三者之间的性能进行对比,只是从三者的特性上区分他们,并指出三者的不用应用场景. 1.publish/subscribe 发布订阅模式如下图所示可以具有多个生产者和发布者,redis.kafka ...

  5. cf 814C 思维

    http://codeforces.com/contest/814/problem/C 给定一个字符串s,长度小于1500,进行q次询问q<=20w,每次询问输入一个m和一个字符c,求将最多m个 ...

  6. GitLab使用总结[转]

    http://blog.csdn.net/huaishu/article/details/50475175 GitLab使用总结

  7. neutron二层网络实现

    一.基本概念 1.tap设备 比如vnet0,是虚拟化技术和KVM和XEN用来实现虚拟网卡的,当一个以太网帧发送给TAP设备时,这个以太网帧就会被虚拟机操作系统所接手,命名空间用于隔离虚拟网络设备. ...

  8. asp.net获取URL和IP地址

    (转自:http://www.cnblogs.com/JuneZhang/archive/2010/11/26/1888863.html) HttpContext.Current.Request.Ur ...

  9. HDU 1561 The more, The Better(树形DP+01背包)

    The more, The Better Time Limit : 6000/2000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other ...

  10. JavaScript中url 传递参数(特殊字符)解决方法及转码解码的介绍

    有些符号在URL中是不能直接传递的,如果要在URL中传递这些特殊符号,那么就要使用他们的编码了.下表中列出了一些URL特殊符号及编码   十六进制值 1. + URL 中+号表示空格 %2B 2. 空 ...