Eclipse配置MyBatis代码自动化功能

栏目: Java · 发布时间: 6年前

内容简介:Eclipse中,Help->Eclipse Marketplace,搜索MyBatis,安装一个扎红头绳小鸟的插件。

阅读更多

1.安装插件

Eclipse中,Help->Eclipse Marketplace,搜索MyBatis,

安装一个扎红头绳小鸟的插件。

2.创建自动化配置文件generatorConfig.xml

新建向导可找到模板,MyBatis->MyBatis Generator Configuration File,可得到一个带有主要配置不需求的模板,再根据自己的情况进行修改。如:

<?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>
  <context id="certTables">
  	<commentGenerator>
  		<property name="suppressAllComments" value="true"/>
  	</commentGenerator>
  	
    <jdbcConnection 
    	connectionURL="jdbc:mysql://127.0.0.1:3306/your_dbname?serverTimezone=Asia/Shanghai" 
    	driverClass="com.mysql.cj.jdbc.Driver" 
    	password="your_passward" 
    	userId="your_userid">
    </jdbcConnection>
    	
    <javaTypeResolver>
    	<property name="forceBigDecimals" value="false"/>
    </javaTypeResolver>
    
    <javaModelGenerator targetPackage="com.wallimn.iteye.sp.asset.bus.cert.model" targetProject="asset">
    	<property name="enableSubPackages" value="false"/>
    	<property name="trimStrings" value="true"/>
    </javaModelGenerator>
    
    <sqlMapGenerator targetPackage="com.wallimn.iteye.sp.asset.bus.cert.model" targetProject="asset">
    	<property name="enableSubPackages" value="false"/>
    </sqlMapGenerator>
    
    <javaClientGenerator targetPackage="com.wallimn.iteye.sp.asset.bus.cert.dao" targetProject="asset" type="XMLMAPPER">
    	<property name="enableSubPackages" value="false"/>
    </javaClientGenerator>
    
     <table tableName="t_c_company"></table>
  </context>
</generatorConfiguration>
3.运行自动代码工具

在配置文件上点右键,Run As,。。。


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

深入浅出Node.js

深入浅出Node.js

朴灵 / 人民邮电出版社 / 2013-12-1 / CNY 69.00

本书从不同的视角介绍了 Node 内在的特点和结构。由首章Node 介绍为索引,涉及Node 的各个方面,主要内容包含模块机制的揭示、异步I/O 实现原理的展现、异步编程的探讨、内存控制的介绍、二进制数据Buffer 的细节、Node 中的网络编程基础、Node 中的Web 开发、进程间的消息传递、Node 测试以及通过Node 构建产品需要的注意事项。最后的附录介绍了Node 的安装、调试、编码......一起来看看 《深入浅出Node.js》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

SHA 加密
SHA 加密

SHA 加密工具

html转js在线工具
html转js在线工具

html转js在线工具