STEP 1. 在maven项目的pom.xml 添加mybatis-generator-maven-plugin 插件

pop.xml

<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.2</version>
</dependency>
<!-- mybatis generator 自动生成代码插件 -->
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<configurationFile>${basedir}/src/main/resources/generator/generateConfig.xml</configurationFile>
<overwrite>true</overwrite>
<verbose>true</verbose>
</configuration>
</plugin>

STEP 2. 在maven项目下的src/main/resources 目录下建立名为 generatorConfig.xml的配置文件,作为mybatis-generator-maven-plugin 插件的执行目标,模板如下:

resources/generator/generateConfig.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>
<classPathEntry
location="D:\mysql-connector-java-5.1.26.jar" />
<context id="context1" targetRuntime="MyBatis3">
<commentGenerator>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true" />
</commentGenerator> <jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://192.168.1.223:3306/pwtp"
userId="root" password="youotech" />
<javaModelGenerator targetPackage="cc.rqzx.www.entity"
targetProject="src/main/java" /> <sqlMapGenerator targetPackage="mapper"
targetProject="src/main/resources" /> <javaClientGenerator type="XMLMAPPER" targetPackage="cc.rqzx.www.dao"
targetProject="src/main/java">
</javaClientGenerator> <table tableName="info" domainObjectName="info"
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false" >
<property name="useActualColumnNames" value="true"/>
</table>
</context>
</generatorConfiguration>

STEP 3. 在Intellij IDEA添加一个“Run运行”选项,使用maven运行mybatis-generator-maven-plugin插件 :

mybatis-generator:generate -e

												

IntelliJ IDEA mybatis-generator的使用的更多相关文章

  1. 记一次 IDEA mybatis.generator 自定义扩展插件

    在使用 idea mybatis.generator 生成的代码,遇到 生成的代码很多重复的地方, 虽然代码是生成的,我们也不应该允许重复的代码出现,因为这些代码后期都要来手动维护. 对于生成时间戳注 ...

  2. Maven多模块项目使用MyBatis Generator

    开发环境: JDK:8u102 Maven:3.3.9 MySQL:5.7.10 MySQL Connector:5.1.40 IDE:IntelliJ IDEA 2016 MyBatis:3.4.1 ...

  3. mybatis.generator.configurationFile

    mybatis.generator.configurationFile 有一个更好的配置方法,可以不用在generateConfig.xml里面写死驱动的地址:如果你的mybatis连接也是在pom. ...

  4. JAVA入门[7]-Mybatis generator(MBG)自动生成mybatis代码

    一.新建测试项目 新建Maven项目MybatisDemo2,修改pom.xml引入依赖.dependencies在上节基础上新增 <dependency> <groupId> ...

  5. SpringBoot入门教程(四)MyBatis generator 注解方式和xml方式

    MyBatis 是一款优秀的持久层框架,它支持定制化 SQL.存储过程以及高级映射.MyBatis 避免了几乎所有的 JDBC 代码和手动设置参数以及获取结果集.MyBatis 可以使用简单的 XML ...

  6. spingBoot整合mybatis+generator+pageHelper

    spingBoot整合mybatis+generator+pageHelper 环境/版本一览: 开发工具:Intellij IDEA 2018.1.4 springboot: 2.0.4.RELEA ...

  7. 在IDEA中使用MyBatis Generator自动生成代码

    转载自 https://blog.csdn.net/hua_faded/article/details/78900780 一.配置Maven pom.xml 文件 在pom.xml增加以下插件:   ...

  8. 在 Gradle 中使用 MyBatis Generator

    在 Intellij IDEA 中结合 Gradle 使用 MyBatis Generator 逆向生成代码 Info: JDK 1.8 Gradle 2.14 Intellij IDEA 2016. ...

  9. 在IDEA中使用MyBatis Generator逆向工程生成代码

    本文介绍一下用Maven工具如何生成Mybatis的代码及映射的文件. 一.配置Maven pom.xml 文件 在pom.xml增加以下插件: <build> <finalName ...

  10. SpringBoot+Mybatis+Generator 逆向工程使用(二)

    Mybatis-Genarator 逆向工程使用 个人开发环境 java环境:Jdk1.8.0_60 编译器:IntelliJ IDEA 2017.1.4 mysql驱动:mysql-connecto ...

随机推荐

  1. winmount导致资源管理器崩溃

    今天,在别人电脑上遇到一个问题,右键点击某个特定文件夹会导致资源管理器崩溃重启,提示为: Runtime Error! Program: C:\Windows\Explorer.exe This ap ...

  2. innobackupex 远程备份

    # 远程备份./innobackupex --defaults-file=/etc/my.cnf --no-timestamp -user xxx --host xx.xx.123 --passwor ...

  3. IDEA编译时出现 Information:java: javacTask: 源发行版 1.8 需要目标发行版 1.8

    错误如下 检查下面几个地方设置是否一致... 1.Project Structure下(File->Project Structure...) Sources选项卡->Languate l ...

  4. React 生命周期及使用场景

    对比版本:16.4.0 VS 16.3.0 VS 16.2.0 发现最近几次React版本更改比较大,在为17.0的大版本作准备.总结了一下React生命周期函数的变化. 综合对比图如下: 各版本分别 ...

  5. IE6设置li的float:left,不能自适应宽的解决方法

    原文地址:https://blog.csdn.net/u012299002/article/details/50589453 做个divcss页面,发现在IE6下,设置了li的float:left,L ...

  6. 8、Zookeeper分布式锁

    基础知识:http://www.cnblogs.com/LiZhiW/p/4931577.html 1 可重入读写锁示例代码如下(lock.acquire加几个,就必须使用几个lock.release ...

  7. Validation.Add();Excel

    Irange = (Microsoft.Office.Interop.Excel.Range)worksheet.get_Range("I1", "I1").g ...

  8. 起源-C的故事

    ———C语言的起源故事(简史)——— C语言在70年代问世的,1978年由美国电话公司(AT&T)贝尔实验室正式发表.B.W.Kernighan和D.M.Ritchit合著了著名的" ...

  9. scheduleAtFixedRate 与 scheduleWithFixedDelay 的区别

    总结: scheduleAtFixedRate ,是以上一个任务开始的时间计时,period时间过去后,检测上一个任务是否执行完毕,如果上一个任务执行完毕,则当前任务立即执行,如果上一个任务没有执行完 ...

  10. pinyin.js

    export default { a: "\u554a\u963f\u9515", ai: "\u57c3\u6328\u54ce\u5509\u54c0\u7691\u ...