idea逆向工程配置

 

generatorConfig.xml配置文件:<?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="test" targetRuntime="MyBatis3">
        <commentGenerator>            <!-- 是否去除自动生成的注释 true:是 : false:否 -->            <property name="suppressAllComments" value="true" />        </commentGenerator>        <!--数据库链接URL,用户名、密码 -->        <jdbcConnection driverClass="com.mysql.jdbc.Driver"                        connectionURL="jdbc:mysql://localhost:3306/crmpro" userId="root"                        password="root">        </jdbcConnection>        <javaTypeResolver>            <property name="forceBigDecimals" value="false" />        </javaTypeResolver>        <!-- 生成模型的包名和位置 -->        <javaModelGenerator targetPackage="bean" targetProject="target">            <property name="enableSubPackages" value="true" />            <property name="trimStrings" value="true" />        </javaModelGenerator>        <!-- 生成映射文件的包名和位置 -->        <sqlMapGenerator targetPackage="mapper"  targetProject="target">            <property name="enableSubPackages" value="true" />        </sqlMapGenerator>        <!-- 生成DAO的包名和位置 -->        <javaClientGenerator type="XMLMAPPER"  targetPackage="mapper" implementationPackage="cn.blog.service.impl"                             targetProject="target">            <property name="enableSubPackages" value="true" />        </javaClientGenerator>


        <!-- 要生成哪些表 -->        <table tableName="analysis" domainObjectName="Analysis"></table>        <table tableName="archives" domainObjectName="Archives"></table>        <table tableName="attachment" domainObjectName="Attachment"></table>        <table tableName="baoxiao" domainObjectName="BaoXiao"></table>        <table tableName="customer" domainObjectName="Customer"></table>        <table tableName="dept" domainObjectName="Dept"></table>        <table tableName="email" domainObjectName="Email"></table>        <table tableName="forumpost" domainObjectName="ForumPost"></table>        <table tableName="function" domainObjectName="Function"></table>        <table tableName="level" domainObjectName="Level"></table>        <table tableName="module" domainObjectName="Model"></table>
        <table tableName="msg" domainObjectName="Msg"></table>        <table tableName="notice" domainObjectName="Notice"></table>        <table tableName="position" domainObjectName="Position"></table>        <table tableName="role" domainObjectName="Role"></table>        <table tableName="sources" domainObjectName="Sources"></table>        <table tableName="task" domainObjectName="Task"></table>        <table tableName="project" domainObjectName="Project"></table>        <table tableName="employee" domainObjectName="Employee"></table>
    </context></generatorConfiguration>

插件:
        <plugin>          <groupId>org.mybatis.generator</groupId>          <artifactId>mybatis-generator-maven-plugin</artifactId>          <version>1.3.2</version>          <dependencies>            <dependency>              <groupId>mysql</groupId>              <artifactId>mysql-connector-java</artifactId>              <version>5.1.37</version>            </dependency>          </dependencies>          <configuration>            <!--配置文件的路径-->            <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>            <overwrite>true</overwrite>          </configuration>        </plugin>      </plugins>

上一篇:idea 常用配置


下一篇:使用 mybatis 自动生成mapper dao 和xml文件 导的包 generatorConfig配置