idea15 生成mybatis代码
pom.xml
<build>
<finalName>mybatis_generator</finalName>
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.</version>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
src->main->resources下新建文件 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>
<!--数据库驱动jar -->
<!--<classPathEntry location="E:\Project\autoCode\target\mybatis-generator\WEB-INF\lib\mysql-connector-java-5.1.34.jar" />--> <context id="DB2Tables" targetRuntime="MyBatis3Simple">
<!--去除注释 -->
<commentGenerator>
<property name="suppressAllComments" value="true" />
</commentGenerator> <!--数据库连接 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/edu"
userId="root"
password="">
</jdbcConnection>
<!--默认false
Java type resolver will always use java.math.BigDecimal if the database column is of type DECIMAL or NUMERIC.
-->
<!--<javaTypeResolver >-->
<!--<property name="forceBigDecimals" value="false" />-->
<!--</javaTypeResolver>--> <!--生成实体类 指定包名 以及生成的地址 (可以自定义地址,但是路径不存在不会自动创建 使用Maven生成在target目录下,会自动创建) -->
<javaModelGenerator targetPackage="com.pojo" targetProject="MAVEN" >
<!--<property name="enableSubPackages" value="false" />-->
<!--<property name="trimStrings" value="true" />--> </javaModelGenerator>
<!--生成SQLMAP文件 -->
<sqlMapGenerator targetPackage="com.mapper" targetProject="MAVEN">
<property name="enableSubPackages" value="true" /> </sqlMapGenerator>
<!--生成Dao文件 可以配置 type="XMLMAPPER"生成xml的dao实现 context id="DB2Tables" 修改targetRuntime="MyBatis3" -->
<!--<javaClientGenerator type="SPRING" targetPackage="com.qianyan.persistence.dao" targetProject="MAVEN">-->
<!--<property name="enableSubPackages" value="false" />-->
<!--</javaClientGenerator>-->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.imapper" targetProject="MAVEN">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!--对应数据库表 mysql可以加入主键自增 字段命名 忽略某字段等--> <table tableName="t_courses" domainObjectName="TCourses" enableSelectByPrimaryKey="true"
enableUpdateByPrimaryKey="true"
enableDeleteByPrimaryKey="true" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false"
enableUpdateByExample="false"> </table> <table tableName="t_courses_chapter" domainObjectName="TCoursesChapter" enableSelectByPrimaryKey="true"
enableUpdateByPrimaryKey="true"
enableDeleteByPrimaryKey="true" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false"
enableUpdateByExample="false"> </table> <table tableName="t_teacher" domainObjectName="TTeacher" enableSelectByPrimaryKey="true"
enableUpdateByPrimaryKey="true"
enableDeleteByPrimaryKey="true" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false"
enableUpdateByExample="false"> </table> <table tableName="t_comments" domainObjectName="TComments" enableSelectByPrimaryKey="true"
enableUpdateByPrimaryKey="true"
enableDeleteByPrimaryKey="true" enableSelectByExample="false" enableDeleteByExample="false" enableCountByExample="false"
enableUpdateByExample="false"> </table>
</context>
</generatorConfiguration>
然后到 maven project ->mybatis-generator ->mybatis-generator:generate 右键->run maven build
如果没有提示错误就会在target文件中生相应的代码
idea15 生成mybatis代码的更多相关文章
- 使用mybatis-generator工具自动生成mybatis代码
使用mybatis-generator工具自动生成mybatis代码 步骤如下: 1.引入maven 依赖,在项目pom.xml文件中添加 <plugin> <groupId> ...
- 用Maven插件生成Mybatis代码/数据库
现在代码管理基本上是采用Maven管理,Maven的好处此处不多说,大家用百度搜索会有很多介绍,本文介绍一下用Maven工具如何生成Mybatis的代码及映射的文件. 一.配置Maven pom.xm ...
- 用Maven插件生成Mybatis代码
现在代码管理基本上是采用Maven管理,Maven的好处此处不多说,大家用百度搜索会有很多介绍,本文介绍一下用Maven工具如何生成Mybatis的代码及映射的文件. 一.配置Maven pom.xm ...
- JAVA入门[7]-Mybatis generator(MBG)自动生成mybatis代码
一.新建测试项目 新建Maven项目MybatisDemo2,修改pom.xml引入依赖.dependencies在上节基础上新增 <dependency> <groupId> ...
- 【转】Intellij IDEA 14中使用MyBatis-generator 自动生成MyBatis代码
Intellij IDEA 14 作为Java IDE 神器,接触后发现,非常好用,对它爱不释手,打算离开eclipse和myeclipse,投入Intellij IDEA的怀抱. 然而在使用的过程中 ...
- Intellij IDEA 14中使用MyBatis-generator 自动生成MyBatis代码
一:项目建立好及其基本的测试好 二:在maven项目的pom.xml 添加mybatis-generator-maven-plugin 插件 <build> <finalName&g ...
- IDEA 中使用MyBatis-generator 自动生成MyBatis代码
0.在Intellij IDEA创建maven项目 1. 在maven项目的pom.xml 添加mybatis-generator-maven-plugin 插件 <build> < ...
- 【mybatis源码学习】利用maven插件自动生成mybatis代码
[一]在要生成代码的项目模块的pom.xml文件中添加maven插件 <!--mybatis代码生成器--> <plugin> <groupId>org.mybat ...
- 使用 mybatis-generator 自动生成 MyBatis 代码
首先把这三个文件放到一个目录里,我是放到了C盘下的wangbo目录下: 接下来就是设置config.xml文件了,config.xml: <?xml version="1.0" ...
随机推荐
- 站点防火墙频率api php案例
<?php $apiHost = "http://35.201.139.124/api2/site/index.php"; $router = "token&quo ...
- JMeter学习(八)JDBC测试计划-连接Oracle(转载)
转载自 http://www.cnblogs.com/yangxia-test 一.测试环境准备 Oracle:10g JDBC驱动:classes12.jar oracle安装目录下(orac ...
- JavaScript中判断null、undefined与NaN的方法
1.判断undefined: ? 1 2 3 4 var tmp = undefined; if (typeof(tmp) == "undefined"){ alert(" ...
- 截图软件FastStone
屏幕截图软件(FastStone Capture) 好用,可以粘贴 / 复制. 可以做页面设计,有屏幕标尺,取色器.
- http协议与常见状态码
什么是http: http是属于应用层(基于tcp的连接方式)的面向对象的协议,是计算机通过网络通信的规则,使得浏览器向web服务器请求信息和服务 http协议特点: http是一种无状态协议(对食物 ...
- 链表中倒数第k个结点(python)
题目描述 输入一个链表,输出该链表中倒数第k个结点 # -*- coding:utf-8 -*- # class ListNode: # def __init__(self, x): # self.v ...
- 树形DP+RMQ+尺取法 hdu4123
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4123 参考博客:两种解法-树形dp+二分+单调队列(或RMQ)-hdu-4123-Bob’s Race ...
- WINDOWS内核版本
Windows NT (NT=new technology) WOW64(Windows-on-Windows 64bit) 如何获取Windows 内核版本 1. cmd (win+r) 2. V ...
- 使用python读写CSV文件
# -*- coding:UTF-8 -*- __autor__ = 'zhouli' __date__ = '2018/10/25 21:14' import csv with open('resu ...
- 解决 MySQL 比如我要拉取一个消息表中用户id为1的前10条最新数据
我们都知道,各种主流的社交应用或者阅读应用,基本都有列表类视图,并且都有滑到底部加载更多这一功能, 对应后端就是分页拉取数据.好处不言而喻,一般来说,这些数据项都是按时间倒序排列的,用户只关心最新的动 ...