mybatis-generator 插件
首先肯定要有mybatis的依赖
<!--mybatis spring-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
然后是要mybatis生成代码器核心依赖
<!--mybatis生成代码控件-->
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.2</version>
</dependency>
之后需要MySQL的依赖
<!--MySQL依赖-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
之后需要在build>plugins下加入一个plugin
<!--mybatis generator plugin-->
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<id>Generate MyBatis Files</id>
<goals>
<goal>generate</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.5</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.2</version>
</dependency>
</dependencies>
</plugin>
<!--/mybatis generator plugin-->
点击Apply。
<?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> <context id="DB2Tables" targetRuntime="MyBatis3">
<!--避免生成重复代码的插件-->
<plugin type="com.tansuo365.test1.util.OverIsMergeablePlugin" /> <!--是否在代码中显示注释-->
<commentGenerator>
<property name="suppressDate" value="true" />
<property name="suppressAllComments" value="true" />
</commentGenerator> <!--数据库链接地址账号密码-->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/tansuodb" userId="root" password="xxxxxxxx">
</jdbcConnection>
<!--不知道做什么用的。。。反正贴上来了~-->
<javaTypeResolver>
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!--生成bean类存放位置-->
<javaModelGenerator targetPackage="com.tansuo365.test1.bean" targetProject="src">
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!--生成xml映射文件存放位置-->
<sqlMapGenerator targetPackage="classpath:mappings" targetProject="resources">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<!--生成mapper类存放位置-->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.tansuo365.test1.mapper" targetProject="src">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator> <!--生成对应表及类名-->
<table tableName="petroleum_coke_tbl" domainObjectName="PetroleumCoke" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="true" selectByExampleQueryId="false">
<property name="my.isgen.usekeys" value="true"/>
<property name="useActualColumnNames" value="true"/>
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
<!-- <table tableName="role" domainObjectName="Role" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="true" selectByExampleQueryId="false">
<property name="my.isgen.usekeys" value="true"/>
<property name="useActualColumnNames" value="true"/>
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
<table tableName="permission" domainObjectName="Permission" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="true" selectByExampleQueryId="false">
<property name="my.isgen.usekeys" value="true"/>
<property name="useActualColumnNames" value="true"/>
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
<table tableName="user_role" domainObjectName="UserRole" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="true" selectByExampleQueryId="false">
<property name="my.isgen.usekeys" value="true"/>
<property name="useActualColumnNames" value="true"/>
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
<table tableName="role_permission" domainObjectName="RolePermission" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="true" selectByExampleQueryId="false">
<property name="my.isgen.usekeys" value="true"/>
<property name="useActualColumnNames" value="true"/>
<generatedKey column="id" sqlStatement="JDBC"/>
</table>--> </context>
</generatorConfiguration>
mybatis-generator 插件的更多相关文章
- Myeclipse2014添加mybatis generator插件
Myeclipse2014把mybatis generator插件直接放在dropins文件夹下,重启后不能成功安装mybatis插件. 既然离线安装不成功,可以选择在线安装 1.选择 Help-&g ...
- mybatis generator 插件安装及使用
现在Mybatis特别火,但是在开发中却要经常写实体类和配置文件,会不会特别烦人,所以可以利用Mybatis的代码生成插件来生成这部分代码: 1,打开eclipse,点击Help>Softwar ...
- Eclipse 使用mybatis generator插件自动生成代码
Eclipse 使用mybatis generator插件自动生成代码 标签: mybatis 2016-12-07 15:10 5247人阅读 评论(0) 收藏 举报 .embody{ paddin ...
- Eclipse MyBatis Generator插件安装
目录 Eclipse MyBatis Generator插件安装 Eclipse MyBatis Generator插件安装 1.进入Eclipse Marketplace [Help] -> ...
- Mybatis-Generator_学习_02_使用Mapper专用的MyBatis Generator插件
源码见:https://github.com/shirayner/tk-mybatis-generator 一.要点 二.具体实现 1.项目结构 2.配置 pm.xml <?xml versio ...
- Mybatis Generator插件和PageHelper使用
最近,开始接触web项目开发,项目使用springboot和mybatis,以前一直以为开发过程中实体类,mybatis的xml文件都需要自己手动的去创建. 同事推荐说Mybatis Generato ...
- Mybatis分页-利用Mybatis Generator插件生成基于数据库方言的分页语句,统计记录总数 (转)
众所周知,Mybatis本身没有提供基于数据库方言的分页功能,而是基于JDBC的游标分页,很容易出现性能问题.网上有很多分页的解决方案,不外乎是基于Mybatis本机的插件机制,通过拦截Sql做分页. ...
- 使用Mapper专用的MyBatis Generator插件
使用Maven执行MBG 这里有一个完整的例子,Mybatis-Spring,下面讲解的内容出自这个例子. 使用Maven插件的一个好处是可以将Maven中的属性使用${property}形式在gen ...
- 使用Mybatis Generator插件自动生成映射文件(cmd无法进入文件,dns服务器对区域没有权威等问题)遇到问题
使用Mybatis Genertor插件自动生MyBatis所需要的DAO接口,实体模型类,Mapping映射文件,将生成的代码赋值到项目工程中即可. 有命令行,Eclipse插 ...
- 使用mybatis generator插件,自动生成dao、dto、mapper等文件
mybatis generator 介绍 mybatis generator中文文档http://mbg.cndocs.tk/ MyBatis Generator (MBG) 是一个Mybatis的代 ...
随机推荐
- JZOJ5833 永恒
题目大意 给你一个树,每个节点上有有一个部落,以及部落的人数,要你求出每个节点的子树里面人数最多的部落是哪一个(人数相同部落编号最小的). 思路 全网第一篇分治题解 考虑树的dfs序,然后分治处理,每 ...
- Java 随机数生成工具RandomUtils
RandomUtils /** * <html> * <body> * <P> Copyright 1994 JsonInternational</p> ...
- c#mysql数据库备份还原
1:引用dll MySql.Data.dll, MySqlbackup.dll 2:建一个数据连接静态类 public static class mysql { public static str ...
- 在.net core中数据操作的两种方式(Db first && Code first)
在开发过程中我们通常使用的是Db first这种模式,而在.net core 中推荐使用的却是 code first 反正我是很不习惯这种开发模式 于是就搜寻整个微软的官方文档,终于找到了有关.net ...
- Ubuntu中安装(升级)GraphicsMagick
1 前言 采用官方下载安装包然后强制安装升级Ubuntu中有的老版本gmagick-1.3.28,升级到gmagick-1.3.31 仅用来记录使用. 2.准备工作 1.下载安装包 https://s ...
- 2019 快乐阳光java面试笔试题 (含面试题解析)
本人3年开发经验.18年年底开始跑路找工作,在互联网寒冬下成功拿到阿里巴巴.今日头条.快乐阳光等公司offer,岗位是Java后端开发,最终选择去了快乐阳光. 面试了很多家公司,感觉大部分公司考察的点 ...
- .python3基础之“术语表(1)”
1.注释: 行首有一特殊标志符号运行时告知编程忽略此行:使代码更易于阅读. 例如: #这是一个注释 print("hello world") #print() 方法用于打印输出,p ...
- js正则表达式【续】(相关字符的解释含义)
1.字符类[直接量] . (点号,小数点) 匹配任意单个字符,但是行结束符除外\d 匹配一个0-9之间的阿拉伯数字.等价于[0-9]\D 匹配任意一个不是0-9之间阿拉伯数字的字符.等价于[^0 ...
- springCloud学习6(Spring Cloud Sleuth 分布式跟踪)
springcloud 总集:https://www.tapme.top/blog/detail/2019-02-28-11-33 前言 在第四篇和第五篇中提到一个叫关联 id的东西,用这个东西来 ...
- 存储管理器 S3C2440A
CPU通过存储管理器来控制外部设备 SDRAM存储结构 S3C2440A内存控制器 原理图 HY57V561620(L)T 4Banks x 4M x 16Bit Synchronous DRAM S ...