原文:http://myoss.github.io/2016/MyBatis-Plugin-%E5%AD%A6%E4%B9%A0%E4%BD%BF%E7%94%A8/

MyBatis Plugin 学习使用

关于本教程

以下教程仅供学习使用,针对于IntelliJ Idea 15(目前已经支持IntelliJ Idea 2016)中的Mybatis Plugin插件(https://plugins.jetbrains.com/plugin/7293?pr=idea),后续作者会抽业余时间更新

如果你觉得本项目能帮助到你,那就Fork一下吧

项目地址:https://github.com/myoss/profile

idea中装mybatis plugin插件

下载插件

前提你已经在IntelliJ Idea中安装好了Mybatis Plugin,并且重启过了IntelliJ Idea

下载profile项目(项目地址:https://github.com/myoss/profile)之后,找到目录:profile\idea\plugin\MybatisPlugin,并选择IntelliJ Idea中安装Mybatis Plugin的版本


git clone [email protected]:myoss/profile.git

windows系统

查找Idea插件配置目录

IntelliJ Idea安装Mybatis Plugin之后,默认保存的位置如下,前提你没有更改过IntelliJ Idea配置目录


C:\Users\你的账户目录\.IntelliJIdea15\config\plugins\mybatis_plus\lib

替换class文件

WinRAR打开mybatis_plus.jar,将目录profile\idea\plugin\MybatisPlugin\对应的版本号\下的com文件夹拖进WinRAR,根据提示覆盖即可

idea中装mybatis plugin插件

重启IntelliJ Idea

就这样完成了,教程完毕

mac os系统

由于mac osIntelliJ Idea的配置文件目录不一致,所以配置起来有些不一样。linux系统中应该类似,我没有验证,如果有兄弟验证过还请告诉我,感谢

查找Idea插件配置目录

使用find命令在你的用户目录下查找mybatis_plus.jar这个文件(前提你没有更改过IntelliJ Idea的配置目录,如果更改了从根目录下查找吧,花费的时间可能会多点)


$ find ~ -name "mybatis_plus.jar"
/Users/jerry-osx-m/Library/Application Support/IntelliJIdea15/mybatis_plus/lib/mybatis_plus.jar
$ find ~ -name "mybatis_plus.jar"
/Users/Jerry/Library/Application Support/IntelliJIdea2016.1/mybatis_plus/lib/mybatis_plus.jar

替换class文件

方法1,在windows系统中将mybatis_plus.jar包替换好,然后替换掉macmybatis_plus.jar即可。

方法2,在mac 终端中,使用以下命令进行替换


$ pwd
/Users/jerry/Library/Application Support/IntelliJIdea2016.3/mybatis_plus/lib
$ ls
mybatis-generator-core-1.3.2.jar mybatis_plus.jar ref.idea.common-1.0.jar
# 将要使用版本的 com 文件复制到当前目录中
$ cp -R ~/workspaces/github/profile/idea/plugin/MybatisPlugin/v2.7~v2.87/ .
$ ls
com mybatis_plus.jar
mybatis-generator-core-1.3.2.jar ref.idea.common-1.0.jar
# 使用 jar 命令进行替换,注意 com 文件夹一定要当前目录下面
$ jar uvf mybatis_plus.jar com
正在添加: com/(输入 = 0) (输出 = 0)(存储了 0%)
正在添加: com/seventh7/(输入 = 0) (输出 = 0)(存储了 0%)
正在添加: com/seventh7/mybatis/(输入 = 0) (输出 = 0)(存储了 0%)
正在添加: com/seventh7/mybatis/dom/(输入 = 0) (输出 = 0)(存储了 0%)
正在添加: com/seventh7/mybatis/dom/model/(输入 = 0) (输出 = 0)(存储了 0%)
正在添加: com/seventh7/mybatis/ref/(输入 = 0) (输出 = 0)(存储了 0%)
正在添加: com/seventh7/mybatis/ref/license/(输入 = 0) (输出 = 0)(存储了 0%)
正在添加: com/seventh7/mybatis/ref/license/ActivationDriver$1.class(输入 = 1926) (输出 = 797)(压缩了 58%)
正在添加: com/seventh7/mybatis/ref/license/ActivationDriver.class(输入 = 1398) (输出 = 656)(压缩了 53%)
正在添加: com/seventh7/mybatis/ref/RefProject$1.class(输入 = 2224) (输出 = 1092)(压缩了 50%)
正在添加: com/seventh7/mybatis/ref/RefProject.class(输入 = 1982) (输出 = 919)(压缩了 53%)
正在添加: com/seventh7/mybatis/service/(输入 = 0) (输出 = 0)(存储了 0%)
正在添加: com/seventh7/mybatis/service/JavaService$1.class(输入 = 1408) (输出 = 613)(压缩了 56%)
正在添加: com/seventh7/mybatis/service/JavaService$2.class(输入 = 1312) (输出 = 575)(压缩了 56%)
正在添加: com/seventh7/mybatis/service/JavaService.class(输入 = 10921) (输出 = 4166)(压缩了 61%)
正在添加: com/seventh7/mybatis/util/(输入 = 0) (输出 = 0)(存储了 0%)
正在添加: com/seventh7/mybatis/util/JavaUtils$SystemData.class(输入 = 3412) (输出 = 1602)(压缩了 53%)
正在添加: com/seventh7/mybatis/util/JavaUtils.class(输入 = 13339) (输出 = 4773)(压缩了 64%)
正在添加: com/seventh7/mybatis/dom/model/Completion.class(输入 = 1663) (输出 = 923)(压缩了 44%)

方法3,参考网友在mac中使用类似 WinRar 软件进行替换:点击我跳转

重启IntelliJ Idea

就这样完成了,教程完毕

分类:

技术点:

相关文章: