迷茫2017-04-18 09:48:16
直接上代码,这是配置文件,指定你的生成路径。然后再该目录下,执行命令:mvn mybatis-generator:generate
<?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>
<!-- oracle-connector的位置 -->
<classPathEntry
location="D:/myproject/.m2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar" />
<!-- 配置一个代码生成操作,如果生成的目录或是数据库不一样,只需要参考增加一个context节点即可 -->
<context id="rock_auth_app_sys" targetRuntime="MyBatis3">
<property name="suppressAllComments" value="true" />
<property name="useActualColumnNames" value="false" />
<!-- 配置插件 -->
<plugin
type="com.rock.dal.mybatis.MysqlPaginationPlugin" />
<jdbcConnection driverClass="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://10.101.234.27:3308/idcm" userId="数据库用户名"
password="数据库密码">
</jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- mvn mybatis-generator:generate -->
<!-- 配置model生成位置 -->
<javaModelGenerator targetPackage="com.alibaba.tboss.dal.mysql.workOrder"
targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- 配置sqlmap生成位置 -->
<sqlMapGenerator targetPackage="com.alibaba.tboss.dal.mysql.workOrder.mapper"
targetProject="src/main/resources">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<!-- 配置mapper接口生成位置 -->
<javaClientGenerator type="XMLMAPPER"
targetPackage="com.alibaba.tboss.dal.mysql.workOrder.mapper" targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<!-- mvn mybatis-generator:generate -->
<table schema="idcm" tableName="idc_logistics_assign_rules" domainObjectName="LogisticsAssignRules"
enableUpdateByExample="false" enableDeleteByExample="false">
</table>
</context>
</generatorConfiguration>