java代码自动生成自动生成工具介绍1:MyBatisCodeHelper-Pro 2:generatorConfig.xml文件

1:MyBatisCodeHelper-Pro


MyBatisCodeHelper-Pro不需要任何的jar包
只需要idea里面安装MyBatisCodeHelper-Pro插件即可。

使用教程

MyBatisCodeHelper-Pro破解版下载参考链接

2:generatorConfig.xml


pom依赖

<!--引入插件-->
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <excludes>
                    <exclude>system/</exclude>
                    <!--
                    <exclude>*.yml</exclude>
                    -->
                    <exclude>*.xml</exclude>
                    <exclude>*.properties</exclude>
                </excludes>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <finalName>${project-name}</finalName>
                <appendAssemblyId>true</appendAssemblyId>
                <descriptors>
                    <descriptor>../s-assembly/server-src.xml</descriptor><!--对应着打包配置-->
                </descriptors>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>pre-site</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <!-- 主要插件 -->
        <plugin>
            <groupId>org.mybatis.generator</groupId>
            <artifactId>osd-mybatis-generator-maven-plugin</artifactId>
            <version>1.3.7</version>
            <configuration>
                <verbose>true</verbose>
                <overwrite>true</overwrite>
            </configuration>
        </plugin>
    </plugins>
</build>

使用方法: 双击自动生成
java代码自动生成自动生成工具介绍1:MyBatisCodeHelper-Pro 2:generatorConfig.xml文件_第1张图片

配置生成文件存放位置

<?xml version="1.0" encoding="UTF-8"?>
<!--

       Copyright ${license.git.copyrightYears} the original author or authors.

       Licensed under the Apache License, Version 2.0 (the "License");
       you may not use this file except in compliance with the License.
       You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing, software
       distributed under the License is distributed on an "AS IS" BASIS,
       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       See the License for the specific language governing permissions and
       limitations under the License.

-->
<!DOCTYPE generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
    <!--驱动文件指定配置项 -->
    <classPathEntry location="D:\settingjn\repo\mysql\mysql-connector-java\5.1.47\mysql-connector-java-5.1.47.jar"/>

    <context id="DB2Tables" targetRuntime="MyBatis3">
        <!--<property name="javaFileEncoding" value="UTF-8"/>-->
        <!--<plugin type="org.mybatis.generator.plugins.RowBoundsPlugin"/>-->
        <!--plugin type="mybatis.generator.plugins.ModelCommentsPlugin"/-->
        <!--
        <plugin type="org.mybatis.generator.osd.mybatis3.plugin.HandlerGenerator" >
            <property name="targetProject" value="E:/AICloud/tool/mybatis-generator/src" />
            <property name="targetPackage" value="com.ai.osd.dao.api.handler" />
            version为1.0对应1.06版本的handler,2.0对应2.0版本的handler
            <property name="version" value="1.0" />
        </plugin>
        -->
        <!--<plugin type="org.mybatis.generator.osd.mybatis3.plugin.CriteriaPackageRenamePlugin" >-->
        <!--<property name="targetPackage" value="com.ai.odf.m.domain.dao.criteria" />-->
        <!--</plugin>-->
        <!--代码上面的注释规则  false时打开注释,true时关闭注释-->
        <commentGenerator>
            <property name="suppressAllComments" value="true"/>
            <property name="suppressDate" value="true"/>
        </commentGenerator>
        <!--jdbc配置-->
        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
                        connectionURL="jdbc:mysql://localhost:3306/test" userId="root"
                        password="123456">
        </jdbcConnection>
        <!--mybatis里专门用来处理NUMERIC和DECIMAL类型的策略-->
        <javaTypeResolver>
            <property name="forceBigDecimals" value="false"/>
        </javaTypeResolver>
        <!--实体类生成配置-->
        <javaModelGenerator targetPackage="com.cmcc.unidoc.domain" targetProject="E:\workspace-1\newCodes2\unidoc-m-server\src\test\java">
            <property name="enableSubPackages" value="true"/>
            <property name="trimStrings" value="true"/>
        </javaModelGenerator>
        <!--生成sql语句的xml文件-->
        <sqlMapGenerator targetPackage="mybatis.mapper" targetProject="E:\workspace-1\newCodes2\unidoc-m-server\src\test\resources">
            <property name="enableSubPackages" value="true"/>
        </sqlMapGenerator>
        <!--Mapper生成配置-->
        <javaClientGenerator type="XMLMAPPER" targetPackage="com.cmcc.unidoc.dao" targetProject="E:\workspace-1\newCodes2\unidoc-m-server\src\test\java">
            <property name="enableSubPackages" value="true"/>
        </javaClientGenerator>

        <!-- ****************要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名*****************-->

        <table tableName="t_centre_opt_judgment"/>

    </context>
</generatorConfiguration>

你可能感兴趣的:(java代码自动生成自动生成工具介绍1:MyBatisCodeHelper-Pro 2:generatorConfig.xml文件)