mybatis generator 整合lombok

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">

<generatorConfiguration>
    <context id="Mysql" targetRuntime="MyBatis3Simple" defaultModelType="flat">
        <property name="beginningDelimiter" value="`" />
        <property name="endingDelimiter" value="`" />
        <plugin type="tk.mybatis.mapper.generator.MapperPlugin">
            <property name="mappers" value="tk.mybatis.mapper.common.Mapper" />
        </plugin>
        <plugin type="com.chrm.mybatis.generator.plugins.LombokPlugin">
            <property name="hasLombok" value="true" />
        </plugin>
        
        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
            connectionURL=""
            userId="" password="">
        </jdbcConnection>
        <javaModelGenerator targetPackage="com.qmtt.model" targetProject="D:\workspace" />
        <sqlMapGenerator targetPackage="com.qmtt.mapperXml" targetProject="D:\workspace" />
        <javaClientGenerator targetPackage="com.qmtt.mapper" targetProject="D:\workspace"
            type="XMLMAPPER" />

        <table tableName="voc_analyze_file_ret">
            <domainObjectRenamingRule searchString="^Voc" replaceString="" />
        </table>
    </context>
</generatorConfiguration>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
<!-- 通用mapper生成插件 -->
            <plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.6</version>
                <configuration>
                    <configurationFile>${basedir}/src/main/resources/generatorConfig.xml</configurationFile>
                    <overwrite>true</overwrite>
                    <verbose>true</verbose>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>mysql</groupId>
                        <artifactId>mysql-connector-java</artifactId>
                        <version>5.1.44</version>
                    </dependency>
                    <dependency>
                        <groupId>tk.mybatis</groupId>
                        <artifactId>mapper</artifactId>
                        <version>3.4.6</version>
                    </dependency>
                    <dependency>
                        <groupId>com.chrm</groupId>
                        <artifactId>mybatis-generator-lombok-plugin</artifactId>
                        <version>1.0-SNAPSHOT</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>

mybatis-generator-lombok-plugin下载地址 https://github.com/GuoGuiRong/mybatis-generator-lombok-plugin,下载完执行mvn install

 

    原文作者:MyBatis
    原文地址: https://www.cnblogs.com/wujf/p/10689210.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞