MybatisX 是一款基于 IDEA 的快速開(kāi)發(fā)插件,方便在使用mybatis以及mybatis-plus開(kāi)發(fā)時(shí)簡(jiǎn)化繁瑣的重復(fù)操作,提高開(kāi)發(fā)速率。
MybatisX的作用就是幫助我們自動(dòng)化建立mybatis的相關(guān)文件,免去手動(dòng)建立的繁瑣!文章源自四五設(shè)計(jì)網(wǎng)-http://www.4968ejs.cn/35263.html
一、安裝MybatisX插件
在插件管理中,搜索Mybatis,就會(huì)顯示MybatisX,然后我們點(diǎn)擊它右側(cè)的Install按鈕,就能安裝了。文章源自四五設(shè)計(jì)網(wǎng)-http://www.4968ejs.cn/35263.html
文章源自四五設(shè)計(jì)網(wǎng)-http://www.4968ejs.cn/35263.html
二、引用相關(guān)的依賴(lài)
本人是SpringBoot框架,引入如下Pom內(nèi)容文章源自四五設(shè)計(jì)網(wǎng)-http://www.4968ejs.cn/35263.html
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.1.0</version> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.5.1</version> </dependency>
三、連接MySQL
1、點(diǎn)擊“Database”文章源自四五設(shè)計(jì)網(wǎng)-http://www.4968ejs.cn/35263.html
2、點(diǎn)擊“+”號(hào),然后選擇Data Source文章源自四五設(shè)計(jì)網(wǎng)-http://www.4968ejs.cn/35263.html
3、在顯示的所有數(shù)據(jù)源中。選擇Mysql文章源自四五設(shè)計(jì)網(wǎng)-http://www.4968ejs.cn/35263.html
文章源自四五設(shè)計(jì)網(wǎng)-http://www.4968ejs.cn/35263.html
4、在顯示的數(shù)據(jù)源配置頁(yè)面,至少填寫(xiě)3項(xiàng)內(nèi)容文章源自四五設(shè)計(jì)網(wǎng)-http://www.4968ejs.cn/35263.html
1)用戶名文章源自四五設(shè)計(jì)網(wǎng)-http://www.4968ejs.cn/35263.html
2)密碼
3)數(shù)據(jù)庫(kù)鏈接信息
5、填寫(xiě)完數(shù)據(jù)源配置信息后,在Database下面多出了一個(gè)數(shù)據(jù)庫(kù)顯示:
6、在我們添加的數(shù)據(jù)源Mysql數(shù)據(jù)庫(kù)中,添加我們需要使用的數(shù)據(jù)庫(kù)。
點(diǎn)擊“0 of 7”這個(gè)位置,顯示了該Mysql數(shù)據(jù)庫(kù)下面所有的數(shù)據(jù)庫(kù)
我們選中其中我們需要使用的數(shù)據(jù)庫(kù),然后按鍵盤(pán)上的enter鍵,就會(huì)完成數(shù)據(jù)庫(kù)的選中工作。然后,顯示如下內(nèi)容:
四、開(kāi)始使用MybatisX,選擇數(shù)據(jù)表,配置生產(chǎn)Mybatis文件的路徑,生產(chǎn)最后的文件
1. 選擇一個(gè)數(shù)據(jù)表,然后“右點(diǎn)擊”,在顯示的菜單中選擇“MybatisX-generator”
2. 點(diǎn)擊“MybatisX-generator”,顯示如下信息:
選擇 “Mybatis-Plus3”
點(diǎn)擊finish,最后結(jié)果如下:


評(píng)論