如果不想生成example,在
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=".srcmainjava"> <!-- enableSubPackages:是否让schema作为包的后缀 --> <property name="enableSubPackages" value="true" /> <!-- 从数据库返回的值被清理前后的空格 --> <property name="trimStrings" value="true" /> </javaModelGenerator> <!-- 用于指定生成的SQL映射文件的目标包和目标项目的元素 --> <sqlMapGenerator targetPackage="com.lamsey.mapper" targetProject=".srcmainjava"> <property name="enableSubPackages" value="true" /> </sqlMapGenerator> <!-- targetPackage:Mapper接口生成的位置 --> <javaClientGenerator type="XMLMAPPER" targetPackage="com.lamsey.mapper" targetProject=".srcmainjava"> <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>