介绍
zebra-generator-maven-plugin 是maven插件用来生成Controller,Service和Mapper,数据访问框架采用的是mybatis-plus。
依赖库
名称 | 描述 |
---|---|
velocity | |
maven-plugin-api | |
maven-plugin-annotations | |
mybatis-plus-generator | |
mybatis-plus-boot-starter | |
snakeyaml | yml解析库 |
快速开始
按照以下方式配置plugin,dependencies 必须有数据库驱动依赖, configuration 节点参数
名称 | 描述 | 是否必须 |
---|---|---|
parentPackage | 代码的父目录,src.main.java之后的路径 | 是 |
outPath | 代码生成之后的目录,不写默认是本项目下 | 否 |
author | 代码生成之后的作者 | 否 |
tableName | 数据库表,多个以逗号分割。 | 是 |
schema | 数据库模式,默认public,如果不是public,需要指定 | 否 |
domainName | 领域模型包名称 如果为空,实体会在domain.entity下,接口返回对象会在domain.dto下,接口参数会在domain.vo下 | 否 |
isDynamicMapper | 是否生成mapper 默认为 true | 否 |
isAuditedEntity | 是否继承审计实体 默认为 false | 否 |
xml
<plugin>
<groupId>io.github.zhanghongbin</groupId>
<artifactId>zebra-generator-maven-plugin</artifactId>
<configuration>
<parentPackage>com.feiniaojin.gracefuresponse.example</parentPackage>
<tableName>sys_app_version</tableName>
<author>z</author>
</configuration>
<dependencies>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>${mysql.version}</version>
</dependency>
</dependencies>
</plugin>