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" ...
随机推荐
- dns隧道 dns2tcpd
有些网络的防火墙设置只允许端口53的UDP流量,就不能通过tcp搭建隧道,这种情况下我们可以通过UDP搭建DNS隧道,通过搭建一个DNS服务器委派的子域,这个子域因为使我们自己搭建的主机,这时候就可以 ...
- artTemplate/template.js模板将时间格式化为正常的日期
网上提供的方法用不了 自己琢磨的 注意:ajax的异步方式必须设置成true才行,false不起作用.async: true: <script> function timestamp (v ...
- 设置https以及http转https的问题
公司用的是阿里云服务器win2008server r2 ,环境是phpwamp,出现许多问题.2018-11-12 一 设置https 1.设置httpd.ini 取消以下三个配置的# LoadMod ...
- random 模块 时间模块(time) sys模块 os模块
random 模块 1.随机小数 random.random() 0-1内的随机小数 random.uniform(1,5) 1-5范围内的随机小数 2.随机整数 random.randint( ...
- POJ-1426.Findthemultiple.(BFS)
一开始模拟了一波大数取余结果超时了,最后改成long long过了emmm... 本题大意:给出一个200以内的数n,让你找出一个m使得m % n == 0,要求m只有1和0组成. 本题思路:BFS模 ...
- Python+Selenium学习--下拉框处理
场景 下拉框也是web 页面上非常常见的功能,webdriver 对于一般的下拉框处理起来也相当简单,要想定位下拉框中的内容,首先需要定位到下拉框:这样的二次定位 下拉框一般有以下两种方式: 鼠标移上 ...
- Mac下Chrome浏览器的手机模拟器,开启模拟定位
项目接入百度地图,浏览器调试时需要获取定位信息. 1 打开设置->高级->内容设置->位置,将定位设置为“使用前先询问”,并清空禁止列表. 2 审查元素->Network-&g ...
- 《基于Nginx的中间件架构》学习笔记---2.nginx的优点以及nginx的安装
[优势] 优势1:IO多路复用和epoll模型(详见总结知识) 优势2:轻量级(1.功能模块少:只保留了一些核心代码 2.代码模块化) 优势3:CPU亲和 这里的CPU亲和指的是:是一种把cp ...
- PHP百杂
PHP实时生成并下载超大数据量的EXCEL文件 PHP错误和异常 PHP异常处理机制 我所理解的php缓冲机制及嵌套级别 $nick = 'test'; //简化输出 echo $nick?:''
- Compile、Make和Build的区别
针对Java的开发工具,一般都有Compile.Make和Build三个菜单项,完成的功能的都差不多,但是又有区别. 编译,是将源代码转换为可执行代码的过程.编译需要指定源文件和编译输出的文件路径 ...