IDEA插件之mybatisx插件使用教程(超詳細(xì)!)

  • A+
所屬分類:百科知識(shí)

MybatisX 是一款基于 IDEA 的快速開發(fā)插件,方便在使用mybatis以及mybatis-plus開發(fā)時(shí)簡(jiǎn)化繁瑣的重復(fù)操作,提高開發(fā)速率。

MybatisX的作用就是幫助我們自動(dòng)化建立mybatis的相關(guān)文件,免去手動(dòng)建立的繁瑣!

一、安裝MybatisX插件

在插件管理中,搜索Mybatis,就會(huì)顯示MybatisX,然后我們點(diǎn)擊它右側(cè)的Install按鈕,就能安裝了。

IDEA插件之mybatisx插件使用教程(超詳細(xì)!)

二、引用相關(guān)的依賴

本人是SpringBoot框架,引入如下Pom內(nèi)容

<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”

2、點(diǎn)擊“+”號(hào),然后選擇Data Source

3、在顯示的所有數(shù)據(jù)源中。選擇Mysql

IDEA插件之mybatisx插件使用教程(超詳細(xì)!)

4、在顯示的數(shù)據(jù)源配置頁面,至少填寫3項(xiàng)內(nèi)容

1)用戶名

2)密碼

3)數(shù)據(jù)庫鏈接信息

IDEA插件之mybatisx插件使用教程(超詳細(xì)!)

5、填寫完數(shù)據(jù)源配置信息后,在Database下面多出了一個(gè)數(shù)據(jù)庫顯示:

IDEA插件之mybatisx插件使用教程(超詳細(xì)!)

6、在我們添加的數(shù)據(jù)源Mysql數(shù)據(jù)庫中,添加我們需要使用的數(shù)據(jù)庫。

點(diǎn)擊“0 of 7”這個(gè)位置,顯示了該Mysql數(shù)據(jù)庫下面所有的數(shù)據(jù)庫

IDEA插件之mybatisx插件使用教程(超詳細(xì)!)

我們選中其中我們需要使用的數(shù)據(jù)庫,然后按鍵盤上的enter鍵,就會(huì)完成數(shù)據(jù)庫的選中工作。然后,顯示如下內(nèi)容:

IDEA插件之mybatisx插件使用教程(超詳細(xì)!)

四、開始使用MybatisX,選擇數(shù)據(jù)表,配置生產(chǎn)Mybatis文件的路徑,生產(chǎn)最后的文件

1. 選擇一個(gè)數(shù)據(jù)表,然后“右點(diǎn)擊”,在顯示的菜單中選擇“MybatisX-generator”

IDEA插件之mybatisx插件使用教程(超詳細(xì)!)

2. 點(diǎn)擊“MybatisX-generator”,顯示如下信息:

IDEA插件之mybatisx插件使用教程(超詳細(xì)!)

選擇 “Mybatis-Plus3”

IDEA插件之mybatisx插件使用教程(超詳細(xì)!)

點(diǎn)擊finish,最后結(jié)果如下:

IDEA插件之mybatisx插件使用教程(超詳細(xì)!)

歷史上的今天:

推薦應(yīng)用

發(fā)表評(píng)論

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: