MyBatis数据库测试代码自动生成
<!-- generatorConfig.xml配置,其中:<plugin type="org.mybatis.generator.plugins.ToStringPlugin" /> 可以直接将list返回值展示出来,而非地址-->
<?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>
<!-- 设置mysql驱动路径, 当使用cmd命令自动生成时,需要打开classPathEntry配置; 使用java类生成时,需要注释classPathEntry配置 -->
<!-- <classPathEntry location="./mysql-connector-java-5.1.27.jar" /> -->
<!-- 此处指定生成针对MyBatis3的DAO -->
<context id="context1" targetRuntime="MyBatis3">
<plugin type="org.mybatis.generator.plugins.SerializablePlugin" />
<plugin type="org.mybatis.generator.plugins.EqualsHashCodePlugin" />
<plugin type="org.mybatis.generator.plugins.ToStringPlugin" />
<plugin type="org.mybatis.generator.plugins.RenameExampleClassPlugin">
<property name="searchString" value="Example$" />
<property name="replaceString" value="Criteria" />
</plugin>
<!-- 去掉生成出来的代码的注解 -->
<commentGenerator>
<property name="suppressAllComments" value="true" />
<property name="suppressDate" value="true" />
</commentGenerator> <!-- jdbc连接信息 -->
<!-- jdbc:oracle:thin:@172.30.29.147:1521:orcl oracle.jdbc.OracleDriver -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://192.168.138.254:3306/jdd_user?characterEncoding=utf8" userId="root"
password="jdd.com" /> <!-- 默认false,表示把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer; true表示把JDBC DECIMAL
和 NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver> <!-- 生成bean对象 -->
<javaModelGenerator targetPackage="cn.springmvc.model"
targetProject="../ssm/src/main/java">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<!--<property name="enableSubPackages" value="true" /> -->
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true" />
</javaModelGenerator> <!-- 生成sqlMap xml -->
<sqlMapGenerator targetPackage="mapper"
targetProject="../ssm/src/main/resources" /> <!-- 生成DAO的类文件 -->
<javaClientGenerator targetPackage="cn.springmvc.dao"
targetProject="../ssm/src/main/java" type="XMLMAPPER">
<property name="enableSubPackages" value="true" />
</javaClientGenerator> <table tableName="user_base_info" domainObjectName="UserBaseInfo"></table> <!-- 想要生成的数据库表,自动化工具会根据该表的结构生成相应的bean对象 -->
<!-- <table tableName="content" domainObjectName="Content"></table>
<table tableName="content_pic" domainObjectName="ContentPic"></table>--> <!-- <table tableName="content_pic" domainObjectName="ContentPic"></table> -->
<!-- <table tableName="sinoicity_user" domainObjectName="User"></table>
<table tableName="sinoicity_dept" domainObjectName="Dept"></table> <table
tableName="sinoicity_function" domainObjectName="Function"></table> <table
tableName="sinoicity_role" domainObjectName="Role"></table> <table tableName="sinoicity_upmessage"
domainObjectName="Upmessage"></table> <table tableName="sinoicity_funcrole"
domainObjectName="Funcrole"></table> -->
</context>
</generatorConfiguration> <!-- 1.打开当前配置项classPathEntry 2.打开cmd,到含有mybatis-generator-core-1.3.2.jar的目录中,cd
D:\idea\webmailmanager\src\main\webapp\WEB-INF\lib 3.java -jar mybatis-generator-core-1.3.2.jar
-configfile D:\idea\webmailmanager\src\test\resources\generatorConfig.xml
-overwrite -->
MyBatis数据库测试代码自动生成的更多相关文章
- 基于数据库的代码自动生成工具,生成JavaBean、生成数据库文档、生成前后端代码等(v6.0.0版)
TableGo v6.0.0 版震撼发布,此次版本更新如下: 1.UI界面大改版,组件大调整,提升界面功能的可扩展性. 2.新增BeautyEye主题,界面更加清新美观,也可以通过配置切换到原生Jav ...
- Mybatis最入门---代码自动生成(generatorConfig.xml配置)
[一步是咫尺,一步即天涯] 经过前文的叙述,各位看官是不是已经被Mybatis的强大功能给折服了呢?本文我们将介绍一个能够极大提升我们开发效率的插件:即代码自动生成.这里的代码自动生成包括,与数据库一 ...
- Mybatis 代码自动生成(generatorConfig.xml配置)
博客推荐: Mybatis最入门---代码自动生成(generatorConfig.xml配置) MyBatis Generator generatorConfig.xml配置详解 pom.xml&l ...
- Mybatis代码自动生成(含测试)
一.建立数据库 create database shixun; use shixun; create table user( id int primary key auto_increment , u ...
- eclipse生成mybatis的逆向工程-mybatis代码自动生成
首先,工作中一直在使用命令方式的mybatis的代码自动生成,今天把自己的笔记本直接搞一个在eclipse中生成的逆向代码生成工程,方便自己在家学习使用,在搞这个工程的过程中由于自己搞了一套环境,所i ...
- MyBatis代码自动生成
MyBatis的代码自动生成的功能,由于MyBatis属于一种半自动的ORM框架,所以主要的工作就是配置Mapping映射文件,但是由于手写映射文件很容易出错,所以可利用MyBatis生成器自动生成实 ...
- 基于eclipse的mybatis映射代码自动生成的插件
基于eclipse的mybatis映射代码自动生成的插件 分类: JAVA 数据库 工具相关2012-04-29 00:15 2157人阅读 评论(9) 收藏 举报 eclipsegeneratori ...
- 基于eclipse的mybatis映射代码自动生成的插件http://blog.csdn.net/fu9958/article/details/7521681
基于eclipse的mybatis映射代码自动生成的插件 分类: JAVA 数据库 工具相关2012-04-29 00:15 2157人阅读 评论(9) 收藏 举报 eclipsegeneratori ...
- Spring Boot (七)MyBatis代码自动生成和辅助插件
一.简介 1.1 MyBatis Generator介绍 MyBatis Generator 是MyBatis 官方出品的一款,用来自动生成MyBatis的 mapper.dao.entity 的框架 ...
随机推荐
- springboot用@Autowired和@PostConstruct注解把config配置读取到bean变成静态方法
springboot用@Autowired和@PostConstruct注解把config配置读取到bean变成静态方法 @SpringBootApplication public class Sen ...
- 大数据自学3-Windows客户端DbVisualizer/SQuirreL配置连接hive
前面已经学习了将数据从Sql Server导入到Hive DB,并在Hue的Web界面可以查询,接下来是配置客户端工具直接连Hive数据库,常用的有DbVisualizer.SQuirreL SQL ...
- 垂直打击之JVM剖析
让Java应用程序运行是一回事,但让他们跑得快就是另外一回事了.在面对对象的环境中,性能问题就像来势凶猛的野兽.但JVM的复杂性将性能调整的复杂程度增加了一个级别.这里Refcard涵盖了JVM in ...
- Kattis之旅——Perfect Pth Powers
We say that x is a perfect square if, for some integer b, x = b2. Similarly, x is a perfect cube if, ...
- 网上搜到的权限系统demo
网上搜到的权限系统demo http://www.sojson.com/shiro
- AngularJS的简单入门
AngularJS诞生于2009年,由Misko Hevery等人创建,后为Google所收购.是一款优秀的前端JS框架,已经被用于Google的多款产品当中.AngularJS有着诸多特性,最为核心 ...
- 使用Selenium+firefox抓取网页指定firefox_profile后的问题
from: https://blog.csdn.net/chufazhe/article/details/51145834 摘要:在使用selenium和firefox抓取网页指定firefox_pr ...
- gdb调试程序函数名为问号,什么原因?step by step解决方案
gdb调试程序函数名为问号,什么原因? http://bbs.chinaunix.net/thread-1823649-1-1.html http://www.bubuko.com/infodetai ...
- windows下rabbitmq-c编译(带openssl、无需MinGW)
因为项目原因,需要使用到rabbitmq的c客户端库.首先,参见上一篇windows下openssl编译,如果已经使用cmake编译过了,则先delete cache(File-Delete Cach ...
- 程序员编程艺术:面试和算法心得-(转 July)
1.1 旋转字符串 题目描述 给定一个字符串,要求把字符串前面的若干个字符移动到字符串的尾部,如把字符串“abcdef”前面的2个字符'a'和'b'移动到字符串的尾部,使得原字符串变成字符串“cdef ...