Skip to content

根据数据库表结构生成实体类和对应的 mybatis 接口,包含分页和批量插入

License

Notifications You must be signed in to change notification settings

bridgeli/mybatis-generator-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mybatis-generator-plugin

  • 把该项目 clone 下来之后,在本地执行 mvn clean install 或者 mvn clean deploy (deploy 需要修改 pom 中的 distributionManagement)【已经上传 Maven 中央仓库,所以此步骤不在需要】

  • 在要生成的项目的 pom 文件中添加如下配置:

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.5</version>
                <dependencies>
                    <dependency>
                        <groupId>cn.bridgeli</groupId>
                        <artifactId>mybatis-generator-plugin</artifactId>
                        <version>{lastest_version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <verbose>true</verbose>
                    <overwrite>true</overwrite>
                    <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
                </configuration>
            </plugin>
        </plugins>
    </build>
  • configurationFile 配置 generatorConfig.xml 文件的位置,其内容在本项目的 src/main/resources 有一个模板供参考,copy 其内容放到相应的位置

  • 修改 generatorConfig.xml 中 想用的内容,主要是:jdbcConnectionjavaModelGeneratorsqlMapGeneratorjavaClientGeneratortable

  • 在项目的 pom 所在的地方执行命令:mvn mybatis-generator:generate 生成相应的 Java 类和 mapper 文件

About

根据数据库表结构生成实体类和对应的 mybatis 接口,包含分页和批量插入

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages