mybatis简单快速自动生成代码 Eclipse插件

第一步:打开eclipse

mybatis简单快速自动生成代码 Eclipse插件

第二步

mybatis简单快速自动生成代码 Eclipse插件

第三步

mybatis简单快速自动生成代码 Eclipse插件

第四步:代码部分

<?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="E:\eclipse\code\Ccs\WebContent\WEB-INF\lib\mysql-connector-java-5.1.7-bin.jar"/><!-- 数据库架包地址-->
  <context id="testTables" targetRuntime="MyBatis3">
 <commentGenerator>
    <property name="suppressTypeWarnings" value="true"/>
    <property name="suppressAllComments" value="true"/>
     <property name="suppressDate" value="true"/>
 </commentGenerator>
 <jdbcConnection connectionURL="jdbc:mysql://localhost:3306/ccs" driverClass="com.mysql.jdbc.Driver" password="123456" userId="root" />
 
<javaTypeResolver> 
    <property name="forceBigDecimals" value="false" />  
</javaTypeResolver> 
 
<!-- 生产po类 -->
 <javaModelGenerator targetPackage="com.ccs.domain" targetProject="Ccs/src"><!--把po类产生的项目地址-->
        <property name="enableSubPackages" value="false"/>
     <property name="trimStrings" value="true"/>
 </javaModelGenerator>
 
<!-- 生产mapper映射文件 -->
<sqlMapGenerator targetPackage="com.ccs.dao" targetProject="Ccs/src"><!--把mapper映射文件产生的项目地址-->
    <property name="enableSubPackages" value="false"/>
</sqlMapGenerator>
 
 <!-- 生产接口 -->
<javaClientGenerator targetPackage="com.ccs.dao" implementationPackage="com.ccs.dao" targetProject="Ccs/src" type="XMLMAPPER">
    <property name="enableSubPackages" value="false"/>
 </javaClientGenerator>
 
 <!-- 指定数据库表 ,可以多张表一起自动生成-->
 <table schema="ccss" tableName="user"/><!--第一个参数自己定义,第二个参数必须是数据库表名-->
 <!--  <table schema="???" tableName="???"/> -->
<!--  <table schema="???" tableName="???"/> -->
<!--  <table schema="???" tableName="???"/> -->
 <!--  <table schema="???" tableName="???"/> -->
 </context>
</generatorConfiguration>
 

<!--注意:除了红色标记部分代码块要自己修改,其他部分代码块可以直接套用-->


 
 
 
 
 
 

第五步:运行generatorConfing代码

mybatis简单快速自动生成代码 Eclipse插件

第六步:完成!!!