mybatis逆向工程生成example的問題

 

若是不想生成example,在java

targetRuntime="MyBatis3" 處修改成  targetRuntime="MyBatis3Simple" 

 

<?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="DB2Tables" targetRuntime="MyBatis3" defaultModelType="flat">
      <commentGenerator>
          <!-- 是否去除自動生成的註釋 true:是;false:否 -->
          <property name="suppressAllComments" value="true"/>
      </commentGenerator>
      <!-- 鏈接數據庫 -->
    <jdbcConnection driverClass="com.mysql.jdbc.Driver"
        connectionURL="jdbc:mysql://localhost:3306/e3mall"
        userId="root"
        password="537423Ab">
    </jdbcConnection>
    <!-- 默認false,把JDBC DECIMAL 和 NUMERIC 類型解析爲 Integer,爲 true時把JDBC DECIMAL 
                        和 NUMERIC 類型解析爲java.math.BigDecimal -->
    <javaTypeResolver >
      <property name="forceBigDecimals" value="false" />
    </javaTypeResolver>
    <!-- 用於指定生成的Java模型對象的目標包和目標項目的元素
    .表示當前目錄自身
    ..表示當前目錄的父目錄
     -->
    <javaModelGenerator targetPackage="com.lamsey.pojo" targetProject=".\src\main\java">
      <!-- enableSubPackages:是否讓schema做爲包的後綴 -->
      <property name="enableSubPackages" value="true" />
      <!-- 從數據庫返回的值被清理先後的空格 -->
      <property name="trimStrings" value="true" />
    </javaModelGenerator>
    <!-- 用於指定生成的SQL映射文件的目標包和目標項目的元素 -->
    <sqlMapGenerator targetPackage="com.lamsey.mapper"  targetProject=".\src\main\java">
      <property name="enableSubPackages" value="true" />
    </sqlMapGenerator>
    <!-- targetPackage:Mapper接口生成的位置 -->
    <javaClientGenerator type="XMLMAPPER" targetPackage="com.lamsey.mapper"  targetProject=".\src\main\java">
      <property name="enableSubPackages" value="true" />
    </javaClientGenerator>

    <!-- 指定逆向生成的數據表
    tableName指定表名
    domainObjectName指定生成對象的名字
     -->
        <table schema="" tableName="tb_content" domainObjectName="Content"></table>
        <table schema="" tableName="tb_content_category" domainObjectName="ContentCategory"></table>
        <table schema="" tableName="tb_item" domainObjectName="Item"></table>
        <table schema="" tableName="tb_item_cat" domainObjectName="ItemCat"></table>
        <table schema="" tableName="tb_item_desc" domainObjectName="ItemDesc"></table>
        <table schema="" tableName="tb_item_param" domainObjectName="ItemParam"></table>
        <table schema="" tableName="tb_item_param_item" domainObjectName="ItemParamItem"></table>
        <table schema="" tableName="tb_order" domainObjectName="Order"></table>
        <table schema="" tableName="tb_order_item" domainObjectName="OrderItem"></table>
        <table schema="" tableName="tb_order_shipping" domainObjectName="OrderShipping" ></table>
        <table schema="" tableName="tb_user" domainObjectName="User"></table>
  </context>
</generatorConfiguration>
相關文章
相關標籤/搜索