mybatis generator 用法
<?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 用法的更多相关文章
- mybatis generator的用法
		1 自动生成代码 配置数据库 自动生成三个文件: 第一,java bean文件: 第二,java bean对应的dao文件,但是这里的dao只是一个接口: 第三,mybatis需要的Mapper文件: ... 
- MyBatis Generator 详解
		MyBatis Generator中文文档 MyBatis Generator中文文档地址:http://mbg.cndocs.tk/ 该中文文档由于尽可能和原文内容一致,所以有些地方如果不熟悉,看中 ... 
- MyBatis Generator 详解 【转来纯为备忘】
		版权声明:版权归博主所有,转载请带上本文链接!联系方式:abel533@gmail.com 目录(?)[+] MyBatis Generator中文文档 运行MyBatis Generator X ... 
- mybatis  Generator配置文件详解
		这里按照配置的顺序对配置逐个讲解,更细的内容可以配合中文文档参照. 1. 配置文件头 <?xml version="1.0" encoding="UTF-8&quo ... 
- mybatis.generator.configurationFile
		mybatis.generator.configurationFile 有一个更好的配置方法,可以不用在generateConfig.xml里面写死驱动的地址:如果你的mybatis连接也是在pom. ... 
- Mybatis基本用法--下
		Mybatis基本用法--下 第七部分 mybatis-spring-boot-starter 官网:http://www.mybatis.org/spring-boot-starter/mybati ... 
- MyBatis Generator中文文档
		MyBatis Generator中文文档 MyBatis Generator中文文档地址: http://mbg.cndocs.tk/ 该中文文档由于尽可能和原文内容一致,所以有些地方如果不熟悉,看 ... 
- MyBatis Generator 详解(转)
		MyBatis Generator中文文档 MyBatis Generator中文文档地址:http://mbg.cndocs.tk/ 该中文文档由于尽可能和原文内容一致,所以有些地方如果不熟悉,看中 ... 
- MyBatis Generator 详解  专题
		idea中有plugin可提高效率: http://www.henryxi.com/use-idea-mybatis-plugin-generate-mapper-files eg: <?xml ... 
随机推荐
- docker安装脚本
			此docker安装脚本为官方提供的,可以从网上下载,此处直接把脚本内容贴上. #!/bin/sh set -e # This script is meant for quick & easy ... 
- DESUtil 加密算法
			import java.security.Key; import java.security.Security; import javax.crypto.Cipher; /** *@Title: DE ... 
- jmeter导入jar包后在beanshell中import失效的问题解决
			最近一直很忙,没有时间来更新了,今天抽空把之前遇到的问题记录下来. 之前在使用jmeter做http请求性能压测时,因为要对所有入参做排序再加密作为一个入参,所以写了一段java代码,用来处理入参,打 ... 
- hdu 5979 Convex(水,求面积)
			Convex Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Subm ... 
- lftp使用
			lftp -c 'pget -n 5 ftp://user:password@ftpserver/test.txt' 5 线程数 安装: yum install lftp -y使用语法:lftp - ... 
- python 2 3 读写中文文件 使用codecs最方便
			codecs进行文件的读取 python给我们提供了一个包codecs进行文件的读取,这个包中的open()函数可以指定编码的类型: import codecs f = codecs.open('te ... 
- Spring 自动装配;方法注入
			通过配置defalut—autowire属性,Spring IOC容器可以自动为程序注入Bean:默认是no(不启用自动装配). default—autowire的类型有: byName:通过名称自动 ... 
- Visual Studio Nuget还原步骤
			vs2013是在这里还原: NuGet套件还原步骤(以vs2012为例) 下载别人的范例,出现由于Nuget套件不存在而无法启动时:效果如下图: 步骤如下:1.点击 项目->启用NuGet程序包 ... 
- C#当中利用Attribute实现简易AOP
			首先看一段简单的代码: public partial class Form1 : Form { public Form1() { InitializeComponent(); } //来自UI层的调用 ... 
- 人生苦短之我用Python篇(安装第三方库、正则表达式)
			安装第三方库 两种方法, 一.在DOS界面下运行 pip3 install requests 二.切换至request目录下 cd E:\ python3 setup.py install ----- ... 
