mybatis generator eclipse插件的安装

目的:使用Spring+mybatis自动生成实体类,mapper.xml,mapper.java
方法:引入mybatisGenerator
操作:
1、下载mybatis generator eclipse插件离线包http://download.csdn.net/detail/gxl442172663/7624747#comment
2、将解压的features和plugins两个文件夹内文件复制到Eclipse安装目录对应的文件夹内。
3、重新启动Eclipse。
4、Eclipse中New–>Other–>MyBatis–>MyBatis Generator Configuration File
文件配置如下:

<?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 > 
    <!-- 配置驱动 --> 
    <classPathEntry location="D:\user\681487\.m2\repository\mysql\mysql-connector-java\5.1.31\mysql-connector-java-5.1.31.jar"/>      
    <context id="context1" >      
        <commentGenerator>           
            <property name="suppressDate" value="true"/>             
            <!-- 是否去除自动生成的注释 true:是 : false:否 -->             
            <property name="suppressAllComments" value="true"/>      
         </commentGenerator>    
         <!-- 数据库名称 账号 密码 驱动 -->    
         <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://10.118.46.20:3306/CONS" userId="mysql" password=""/>    
         <!-- 生成实体类 实体bean文件 -->        
         <javaModelGenerator targetPackage="com.sf.hbms.cons.domain" targetProject="HBMS-CONS" />      
         <!-- mapper xml文件 -->    
         <sqlMapGenerator targetPackage="com.sf.hbms.cons.persistence" targetProject="HBMS-CONS" />       
         <!-- mapper 接口文件 -->    
         <javaClientGenerator targetPackage="com.sf.hbms.cons.persistence" targetProject="HBMS-CONS" type="XMLMAPPER" />
         <!-- 数据库的表 -->   
          <table schema="ConsOrder"  tableName="cons_order" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" ></table> 
          <table schema="OonsOrderOsyncresult"  tableName="cons_order_asyncresult" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" ></table> 
         <table schema="ConsOrderDetail"  tableName="cons_order_detail" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" ></table> 
         <table schema="ConsOrderPay"  tableName="cons_order_pay" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" ></table> 
         <table schema="ConsOrderReqresp"  tableName="cons_order_reqresp" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" ></table> 
         <table schema="ConsProducts"  tableName="cons_products" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" ></table>

          <table schema="InThirdOrder"  tableName="in_third_order" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" ></table>
    </context>
</generatorConfiguration>

5、Eclipse中右键generatorConfigure.xml文件,执行性:Generate MyBatis /iBATIS Artifacts,即可生成对应文件。
6、参考链接:http://jingyan.baidu.com/article/9faa7231506ed8473c28cbee.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值