mybatis-generator生成数据表中注释
0、git clone https://github.com/backkoms/mybatis-generator-comments.git,编译打包,install到本地或delopy私服库中均可。
1、pom.xml配置
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>utf8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<configurationFile>
${basedir}/src/test/resources/conf/generatorConfig.xml
</configurationFile>
<overwrite>true</overwrite>
</configuration>
<dependencies>
<dependency>
<groupId>com.zhishi.mybatis</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
2、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> <!-- jdbc路径 -->
<classPathEntry
location="C:\dev\Reporsitory\mysql\mysql-connector-java\5.1.38\mysql-connector-java-5.1.38.jar" />
<context id="context" targetRuntime="MyBatis3">
<plugin type="org.mybatis.generator.plugins.RenameExampleClassPlugin">
<property name="searchString" value="Example$" />
<property name="replaceString" value="Criteria" />
</plugin>
<plugin type="org.mybatis.generator.plugins.CachePlugin">
<property name="cache_eviction" value="LRU" />
<property name="cache_flushInterval" value="60000" />
<property name="cache_readOnly" value="true" />
<property name="cache_size" value="1560" />
</plugin>
<plugin type="org.mybatis.generator.plugins.EqualsHashCodePlugin"></plugin>
<plugin type="org.mybatis.generator.plugins.SerializablePlugin">
<property name="suppressJavaInterface" value="false" />
</plugin>
<commentGenerator
type="org.mybatis.generator.internal.CustomeCommentGenerator"><!-- 数据库表注释生成-- >
<property name="javaFileEncoding" value="UTF-8" />
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="false" />
<property name="suppressDate" value="false" />
</commentGenerator> <!-- 请填写connectionURL、userId、password -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://192.168.1.102:3306/loan" userId="root"
password="root" /> <!-- 生成持久化对象 -->
<javaModelGenerator targetPackage="com.zhishi.domain"
targetProject="src/test/java">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator> <!-- 生成mapper.xml文件 -->
<sqlMapGenerator targetPackage="mapper/mybatis"
targetProject="src/test/resources">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator> <!-- 生成Mapper接口 -->
<javaClientGenerator targetPackage="com.zhishi.dal.mapper.credit"
targetProject="src/main/java" type="XMLMAPPER"> <property name="enableSubPackages" value="true" />
</javaClientGenerator> <!-- 需要生成的数据库表 -->
<table tableName="tb_trx_bank" domainObjectName="TrxBank">
<generatedKey column="tid" sqlStatement=" select replace(uuid(),'-','')" /><!-- 主键为uuid的情况,自动生成-- >
</table>
</context>
</generatorConfiguration>
2、eclipse中Run as --> maven build .... -->Goals中输入命令行:mybatis-generator:generate -e
3、查看生成的文件
/**
* 主键
* 表 : tb_trx_bank
* 对应字段 : tid
*/
private String tid;
/**
* 交易类型
* 表 : tb_trx_bank
* 对应字段 : type
*/
private String type;
本篇为原创内容:转载请注明出处

【一位十年码农的碎碎念,扫码关注获取更多精彩内容】
mybatis-generator生成数据表中注释的更多相关文章
- 【记录】Mybatis Generator生成数据对象Date/TimeStamp 查询时间格式化
Mybatis Generator是很好的工具帮助我们生成表映射关联代码,最近博主遇到一个问题,找了很久才解决, 就是用Mybatis Generator生成实体类的时候,Date 时间无法格式化输出 ...
- hibernate中.hbm.xml和注解方式自动生成数据表的简单实例(由新手小白编写,仅适用新手小白)
绝逼新手小白,so 请大神指点! 如果真的错的太多,错的太离谱,错的误导了其他小伙伴,还望大神请勿喷,大神请担待,大神请高抬贵嘴......谢谢. 好了,正题 刚接触ssh,今天在搞使用.hbm.xm ...
- Mybatis generator生成工具简单介绍
Mybatis generator 其主要的功能就是方便,快捷的创建好Dao,entry,xml 加快了开发速度,使用方面根据其提供的规则配置好就OK 这里还有一个重要的开发场景,开发过程中,对数据 ...
- mybatis Generator生成代码及使用方式
本文原创,转载请注明:http://www.cnblogs.com/fengzheng/p/5889312.html 为什么要有mybatis mybatis 是一个 Java 的 ORM 框架,OR ...
- mybatis generator生成文件大小写问题
mybatis generator插件中,如果 mysql数据表中的字段是用下划线划分的(个人一般都是喜欢这么创建表的字段,如:company_name),那么生成的Vo中会自动对应为companyN ...
- MyBatis Generator 生成的example 使用 and or 简单混合查询
MyBatis Generator 生成的example 使用 and or 简单混合查询 参考博客:https://www.cnblogs.com/kangping/p/6001519.html 简 ...
- Maven下用MyBatis Generator生成文件
使用Maven命令用MyBatis Generator生成MyBatis的文件步骤如下: 1.在mop文件内添加plugin <build> <finalName>KenShr ...
- 转:Sql Server中清空所有数据表中的记录
如果要删除数据表中所有数据只要遍历一下数据库再删除就可以了,清除所有数据我们可以使用搜索出所有表名,构造为一条SQL语句进行清除了,这里我一一给各位同学介绍. 使用sql删除数据库中所有表是不难的 ...
- SpringBoot+Mybatis 自动创建数据表(适用mysql)
Mybatis用了快两年了,在我手上的发展史大概是这样的 第一个阶段 利用Mybatis-Generator自动生成实体类.DAO接口和Mapping映射文件.那时候觉得这个特别好用,大概的过程是这样 ...
随机推荐
- WPF使用NAudio录音
代码: using NAudio.Wave; using System.Windows; namespace NAudioDemo { /// <summary> /// MainWind ...
- 基于事件驱动的DDD领域驱动设计框架分享(附源代码)
原文:基于事件驱动的DDD领域驱动设计框架分享(附源代码) 补充:现在再回过头来看这篇文章,感觉当初自己偏激了,呵呵.不过没有以前的我,怎么会有现在的我和现在的enode框架呢?发现自己进步了真好! ...
- ASP.NET Core 下自定义模型绑定,去除字符串类型前后的空格
效果图: 01 02 直接贴代码了: NoTrim public class NoTrimAttribute : Attribute { } 我们自定义的模型绑定提供程序 /// <summar ...
- 智能合约开发——以太坊 DApp 实现 购买通证token
合约的buy()方法用于提供购买股票的接口.注意关键字payable,有了它买股票的人才可以付钱给你. 接收钱没有比这个再简单的了! function buy() payable public ret ...
- 解析 Qt 字库移植并能显示中文 (上篇)
原文http://mobile.51cto.com/symbian-272552.htm 本文介绍的是Qt 字库移植并能显示中文,需要的字体库文件,一般是多个.具体移植那一个,看你使用的字库是什么了, ...
- PC-lint 简明教程(C/C++静态代码检查工具)
前言 PC-lint是一款小而强大的C/C++静态代码检查工具,它可以检查未初始化变量,数组越界,空指针等编译器很难发现的潜在错误.在很多专业的软件公司如Microsoft,PC-Lint检查无错误无 ...
- Mariadb的安装与使用
一.安装Mariadb 参考博客:https://www.cnblogs.com/pyyu/p/9467289.html 安装软件的三中方式 yum原码编译安装下载rpm安装 yum与原码编译安装安装 ...
- CMD 从文件中截取匹配规则字符串并输出到文件
*******************command**********************git diff 8d71d92b2d957fd1b697b4cf785fb984f190e5d2 or ...
- RSA der加密 p12解密以及配合AES使用详解
在前面的文章中我有说过AES和RSA这两种加密方式,正好在前段时间再项目中有使用到,在这里再把这两种加密方式综合在一起写一下,具体到他们的使用,以及RSA各种加密文件的生成. 一: RSA各种加密相关 ...
- Linux基础及系统优化
1 如何实现自动挂载操作(光驱自动挂载--fstab) 1.1 方法 第一种方法:编辑fstab文件 vi /etc/fstab /dev/cdrom /mnt iso9660 default 0 0 ...