15 Star 182 Fork 104

冯文议 / mybatis-plus-code-generator

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

MyBatis-Plus 代码生成器

Current Version

3.5.4.1-2

说明: 除最后一位,前面的为mybatis-plus-generator的版本号,最后一位为该版本迭代次数。

概述

代码生成器,又被叫做逆向工程,MyBatis官方为了推广,自己也写了一个,我之前也使用这个,功能也是非常强大,强大以为支持自定义配置,那么问题来了,我该怎么配置才合理呢,所以,有人把所有的配置项都弄成中文的,还有人开发了生成插件,这些在我以往的博文中都看看到。MyBatis-Plus的代码生成器到底怎么样,这我就不评判了,我就这样说,用用看吧。

功能列表:

  • 自动生成model类

  • 自动生成dao接口

  • 自动生成xml文件

  • 自动生成service接口

  • 自动生成service实现类

  • model支持Builder模式

  • 支持swagger2

  • 支持生成数据库字段常量

  • 支持生成Kotlin代码

  • ……more……

使用指南

启动项目

方案1: jar

下载:mybatis-plus-code-generator-3.5.4.1-2.jar

运行:

java -jar mybatis-plus-code-generator-3.5.4.1-2.jar

方案2: docker

# 拉取镜像
docker pull fengwenyi/mybatis-plus-code-generator

# 启动服务
docker run -d -p 8899:8899 --name code-generator -v ~/temp:/temp fengwenyi/mybatis-plus-code-generator

# 查看日志
docker logs -f code-generator

# 进入容器
docker exec -it code-generator sh
# or
docker attach code-generator

挂在目录说明:

~/temp:/temp

冒号前面为挂在的目录,你这个自定义,比如:e:/temp。

冒号后面为docker容器目录。

方案3: git clone

将项目git clone到本地,运行即可。

访问

http://localhost:8899

访问上面地址,你就会看的如下高端、大气、上档次的界面了。

生成代码

填写表单信息

必填的主要有两部分,包名和数据库连接信息配置。

这里的包名,指的是,生成的数据库相关的类,要放在哪个包下面。

生成代码

会生成如下文件:

数据库表如下:

其他

更新日志

忽略的字段:

id
create_date_time
update_date_time
status

create_user_id
create_user_name
update_user_id
update_user_name
enabled_state
deleted_state

问题

  • docker本机部署,数据库也在本地,数据库连接地址不能是localhost或者127.0.0.1,要填本机IP
MIT License Copyright (c) 2020-2023 Erwin Feng Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

MyBatis Plus 代码生成器 展开 收起
Java 等 4 种语言
MIT
取消

发行版 (20)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/fengwenyi/mybatis-plus-code-generator.git
git@gitee.com:fengwenyi/mybatis-plus-code-generator.git
fengwenyi
mybatis-plus-code-generator
mybatis-plus-code-generator
main

搜索帮助

14c37bed 8189591 565d56ea 8189591