1 Star 0 Fork 0

又不是不能用/codegen-maven-plugin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 1.45 KB
一键复制 编辑 原始数据 按行查看 历史
鲍庭玉 提交于 2023-07-30 10:05 . update

Auto-generate db entity, mapper interface, mapper XML of MyBatis

  • Java source code: javapoet
  • mapper XML: jdom2

Example

entity

mapper

xml

Quick Start

  1. configure build in pom.xml
<build>
    <plugins>
        <plugin>
            <groupId>site.btyhub</groupId>
            <artifactId>codegen-maven-plugin</artifactId>
            <version>1.0</version>
            <dependencies>
                <dependency>
                    <groupId>com.mysql</groupId>
                    <artifactId>mysql-connector-j</artifactId>
                    <version>${mysql.version}</version>
                </dependency>
            </dependencies>
            <configuration>
                <absoluteFilePath>${absolute path of your yaml/yml config file}</absoluteFilePath>
                <skip>false</skip>
            </configuration>
        </plugin>
    </plugins>
</build>
  1. config file:see sample.yaml in resources dir. only supports yaml/yml for now.

  2. run mvn codegen:codegen

  3. Example use case

       PeopleExample peopleExample = new PeopleExample();
        Criteria criteria = peopleExample.createCriteria();
        criteria.andCreateTimeGt("2023").andIdBetween(1,10).andNameIsNull();
        Criteria or = peopleExample.or();
        or.andIdBetween(100,1000);
        peopleExample.setDistinct(true).setLimit(1).setOffset(199);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/bao-tingyu/codegen-maven-plugin.git
git@gitee.com:bao-tingyu/codegen-maven-plugin.git
bao-tingyu
codegen-maven-plugin
codegen-maven-plugin
master

搜索帮助