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

  • A+
所屬分類:百科知識

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

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

一、安裝MybatisX插件

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

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

二、引用相關(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、點擊“Database”

2、點擊“+”號,然后選擇Data Source

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

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

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

1)用戶名

2)密碼

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

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

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

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

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

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

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

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

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

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

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

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

2. 點擊“MybatisX-generator”,顯示如下信息:

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

選擇 “Mybatis-Plus3”

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

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

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

歷史上的今天:

推薦應用

發(fā)表評論

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