使用idea,自动生成mybatis相关代码
来源:互联网 发布:java包装一年工作经验 编辑:程序博客网 时间:2024/05/17 23:44
使用idea,自动生成mybatis相关代码
第一步用idea创建一个maven项目(略)
第二步用idea添加mybatis_plus插件
导入破解版mybatis_plusjar
mybatis_plus.jar下载路径
密码 ;b65m (注:2.87版)
安装好插件之后,重启idea就可以激活插件
第三步,配置generator文件
样板
<?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="盘:\文件\mysql-connector-java-5.1.34.jar"/> <context id="context" targetRuntime="MyBatis3"> <commentGenerator> <property name="suppressAllComments" value="false"/> <property name="suppressDate" value="true"/> </commentGenerator> <!-- !!!! mysql数据库驱动 !!!! --> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/数据库名?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8" userId="账号" password="密码"/> <!-- !!!! 实体类模板 !!!! --> <javaModelGenerator targetPackage="包名" targetProject="D:\java\Personal\MybatisOne\src\main\java"> <property name="enableSubPackages" value="false"/> <property name="trimStrings" value="true"/> </javaModelGenerator> <!-- !!!! mapper文件!!!! --> <sqlMapGenerator targetPackage="mapper" targetProject="D:\java\Personal\MybatisOne\src\main\java"> <property name="enableSubPackages" value="false"/> </sqlMapGenerator> <!-- !!!! dao文件 !!!! --> <javaClientGenerator targetPackage="dao" targetProject="D:\java\Personal\MybatisOne\src\main\java" type="XMLMAPPER"> <property name="enableSubPackages" value="false"/> </javaClientGenerator> <!-- !!!! 要生成表配置 !!!! --> <table tableName="emp" enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="false" enableUpdateByExample="false"/> </context></generatorConfiguration>
第四步:在pom.xml增加用来执行generator的maven插件
<build> <finalName>MybatisOne</finalName> <!--用来执行generator的maven插件--> <plugins> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.2</version> <configuration> <verbose>true</verbose> <overwrite>true</overwrite> </configuration> </plugin> </plugins> </build>
第五步:在idea配置运行generator配置文件
直接运行就好,日志出现BUILD SUCCESS说明成功(命令:mybatis-generator:generate -e)
附:idea连接mysql数据库
新手,写的不好的地方请多多指教
阅读全文
0 0
- 使用idea,自动生成mybatis相关代码
- Intellij IDEA中使用MyBatis-generator 自动生成MyBatis代码
- Intellij IDEA中使用MyBatis-generator 自动生成MyBatis代码
- Intellij IDEA 中使用MyBatis-generator 自动生成MyBatis代码
- Intellij IDEA 中使用 MyBatis-generator 自动生成 MyBatis 代码
- idea 使用MyBatis-generator 自动生成MyBatis代码
- Intellij IDEA 中使用 MyBatis-generator 自动生成 MyBatis 代码
- Intellij IDEA 中使用 MyBatis-generator 自动生成 MyBatis 代码
- Intellij IDEA中使用MyBatis-generator 自动生成MyBatis代码
- mybatis自动生成代码 IDEA
- 使用Mybatis Generator自动生成Mybatis相关代码
- 使用Mybatis Generator自动生成Mybatis相关代码
- 使用Mybatis Generator自动生成Mybatis相关代码
- 使用Mybatis Generator自动生成Mybatis相关代码
- 使用Mybatis Generator自动生成Mybatis相关代码
- 使用Mybatis Generator自动生成Mybatis相关代码
- 使用Mybatis Generator自动生成Mybatis相关代码
- 使用Mybatis Generator自动生成Mybatis相关代码
- linux cpufreq framework(5)_ARM big Little driver
- 线程池的饱和策略-Semaphore实现任务提交限制
- 第十五周——项目一—验证算法(6)选择排序之堆排序
- android studio下解决 java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/
- ES6数组去重写法
- 使用idea,自动生成mybatis相关代码
- 添加静态路由
- python做量化交易干货分享
- git commit 不小心把账号密码文件提交上去并push到远程后,而且还merge到master分支后 怎么删除commit记录
- okhttp3的详细介绍
- Android 进阶之路:常见设计模式之代理模式一
- 《数字技术》连载29:第4章 信息的寄存传输和转换 第2节 信息的译码,译码器
- 在线与本地myeclipse安装svn
- 项目管理利器—maven(二)