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" ...
随机推荐
- frame嵌套页面元素的定位
这里当出现页面嵌套的时候怎么定位?frame就是对于嵌套页面的定位,今天具体说一下 前期准备工作:先编写一个HTML网页,带有嵌套的,方便我们在案例中使用按照如下截图的代码编写就好了,然后保存为HTM ...
- 跳台阶(python)
题目描述 一只青蛙一次可以跳上1级台阶,也可以跳上2级.求该青蛙跳上一个n级的台阶总共有多少种跳法(先后次序不同算不同的结果). # -*- coding:utf-8 -*- class Soluti ...
- linux下访问window的共享文件,在命令行实现方法
1.挂载共享目录 mount -t cifs //192.168.0.1/aa /tmp/export -o username=text,password=test //192.168.0.1/aa ...
- DC-学习
1.DC概论一:setup time, hold time之一 http://www.blogbus.com/bb2hh-logs/20463915.html 2.DC概论二:fanout, skew ...
- LibreOj 6279数列分块入门 3 练习了一下set
题目链接:https://loj.ac/problem/6279 推荐博客:https://blog.csdn.net/qq_36038511/article/details/79725027 这题区 ...
- Flask中的蓝图(BluePrint)、
蓝图 1.初识Flask蓝图(BluePrint) 创建一个项目然后将目录结构做成: user.py中的内容 from flask import Blueprint, render_template ...
- 对话框 AlterDialog
AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("尊敬的用户"); bu ...
- 如何在比较1.5 len的次数下,找到整型数组最大最小值
2016-11-11 #include <iostream> #include<stdlib.h> #include<stdio.h> using namespac ...
- 动态替换iframe的src及动态改变iframe的高度
实现效果:点击左侧右侧内容变化,但左侧保持不变(如折叠等) 动态替换iframe的src <iframe width="100%" frameBorder="0&q ...
- java 基础之--传统网络编程
什么是socket ? socket 是连接运行在网络上的两个程序间的双向通讯端点 服务器将某一套接字绑定到一个特定的端口,并通过这一套接字等待和监听客户端的的连接请求 客户端通过这个端口与服务器进行 ...