目录文件如下:

generator.xml文件如下:

 <?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:\generator\mysql-connector-java-5.1.34.jar" />
     <!-- <classPathEntry location="C:\oracle\product\10.2.0\db_1\jdbc\lib\ojdbc14.jar" />-->
     <context id="DB2Tables" targetRuntime="MyBatis3">
         <commentGenerator>
             <property name="suppressAllComments" value="true" />
         </commentGenerator>
         <!-- 数据库链接URL、用户名、密码 -->
          <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1:3306/new_taozugong" userId="root" password="root">
         <!--<jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" connectionURL="jdbc:oracle:thin:@localhost:1521:orcl" userId="msa" password="msa">-->
         </jdbcConnection>
         <javaTypeResolver>
             <property name="forceBigDecimals" value="false" />
         </javaTypeResolver>
         <!-- 生成模型的包名和位置 -->
         <javaModelGenerator targetPackage="com.taozugong.admin.common.entity" targetProject="E:\generator\src">
             <property name="enableSubPackages" value="true" />
             <property name="trimStrings" value="true" />
         </javaModelGenerator>
         <!-- 生成的映射文件包名和位置 -->
         <sqlMapGenerator targetPackage="mybatis.mapper" targetProject="E:\generator\src">
             <property name="enableSubPackages" value="true" />
         </sqlMapGenerator>
         <!-- 生成DAO的包名和位置 -->
         <javaClientGenerator type="XMLMAPPER" targetPackage="com.taozugong.admin.dao.mapper" targetProject="E:\generator\src">
             <property name="enableSubPackages" value="true" />
         </javaClientGenerator>
         <!-- 要生成那些表(更改tableName和domainObjectName就可以) -->

         <table tableName="activity" domainObjectName="Activity" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" />
         <table tableName="activity_help_record" domainObjectName="activityHelpRecord" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" />
         <table tableName="activity_product_setting" domainObjectName="activityProductSetting" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" />
         <table tableName="activity_product_template" domainObjectName="activityProductTemplate" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" />
         <table tableName="activity_record" domainObjectName="activityRecord" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" />
     </context>

 </generatorConfiguration>

直接cmd输入如下命令即可生成

java -jar mybatis-generator-core-1.3.2.jar -configfile generator.xml -overwrite

mybatis-generator命令行生成代码的更多相关文章

  1. Eclipse 使用mybatis generator插件自动生成代码

    Eclipse 使用mybatis generator插件自动生成代码 标签: mybatis 2016-12-07 15:10 5247人阅读 评论(0) 收藏 举报 .embody{ paddin ...

  2. springboot(十三):springboot结合mybatis generator逆向工程自动生成代码

    错信息generate failed: Exception getting JDBC Driver: com.mysql.jdbc.Driver 上网查了一下,发现原来是generator这个插件在运 ...

  3. mybatis使用generator自己主动生成代码时的类型转换

    使用mybatis的generator自己主动生成代码,可是oracle数据库中number(6,2)总是自己主动转成BigDecimal.我想要转成的是float类型 这样就写了一个类型转换器,须要 ...

  4. Mybatis Generator的model生成中文注释,支持oracle和mysql(通过实现CommentGenerator接口的方法来实现)

    自己手动实现的前提,对maven项目有基本的了解,在本地成功搭建了maven环境,可以参考我之前的文章:maven环境搭建 项目里新建表时model,mapper以及mapper.xml基本都是用My ...

  5. FreeSql.Generator命令行代码生成器是如何实现的

    目录 FreeSql介绍 FreeSql.Generator RazorEngine.NetCore 源码解析 FreeSql.Tools FreeSql FreeSql 是功能强大的对象关系映射技术 ...

  6. 《Entity Framework 6 Recipes》中文翻译系列 (40) ------ 第七章 使用对象服务之从跟踪器中获取实体与从命令行生成模型(想解决EF第一次查询慢的,请阅读)

    翻译的初衷以及为什么选择<Entity Framework 6 Recipes>来学习,请看本系列开篇 7-5  从跟踪器中获取实体 问题 你想创建一个扩展方法,从跟踪器中获取实体,用于数 ...

  7. cocos命令行生成项目

    cocos命令行生成项目: cocos new GoodDay(项目名称) -p com.boleban.www(包名字) -l cpp(项目类型) -d D:\DevProject\cocos2dx ...

  8. Beyond Compare 命令行生成目录下所有文件比对的Html网页report

    MAC环境下,使用Beyond Compare命令行生成两个文件夹差异的html,按目录递归生成. #1. 创建compare #2. 创建compare/old #3. compare/new #4 ...

  9. 用OpenSSL命令行生成证书文件

    用OpenSSL命令行生成证书文件 1.首先要生成服务器端的私钥(key文件): openssl genrsa -des3 -out server.key 1024 运行时会提示输入密码,此密码用于加 ...

随机推荐

  1. 用php命令执行php脚本报错,在浏览器里执行却正常。

    写了一个Php脚本,里面用到了PDO连接数据库,但是所有的库都已经安装,在浏览器里执行完全正常,但是写到批处理文件里用php命令去执行的时候却报错找不到驱动,很奇怪. 经查找得知原来php命令与浏览器 ...

  2. dede_CMS模板的基础安装

    今天来给大家讲一讲dede_CMS的基础使用方法 那么什么是CMS呢 cms (content manage system 内容管理系统): 比如 新闻/电子商务/电影网/公司宣传网站/软件/文章) ...

  3. Python - Pyinstaller

    安装 Pyinstaller pip install pyinstaller 使用: test.py print("Hello World!") 命令行输入 pyinstaller ...

  4. 如何做一款自己的Android App

    转自:http://www.cnblogs.com/hubcarl/p/4030884.html 正在做App,后续补充: 概述:以我开发的一款编程学习的App[编程在线]为例讲讲如何做一款自己的An ...

  5. 修改android Studio SDK 路径产生的问题(模拟器不能启动了)

    原因:将 c:\user\admin\appdata\android\sdk 修改为 F:\AndroidProgram\Sdk 原来的虚拟机不能用了,要新建虚拟机才可以.

  6. MySQL学习笔记之二---引擎介绍MyISAM VS InnoDB

    前言 MyISAM是MySQL的默认数据库引擎(5.5版之前),由早期的ISAM(Indexed Sequential Access Method:有索引的顺序访问方法)所改良.虽然性能极佳,但却有一 ...

  7. Spring 学习记录8 初识XmlWebApplicationContext(2)

    主题 接上文Spring 学习记录7 初识XmlWebApplicationContext refresh方法 refresh方法是定义在父类AbstractApplicationContext中的. ...

  8. easyui隐藏列

    1.$("#test-datagrid").datagrid('hideColumn', 'password');其中第二个参数为对应的域,即field 2. <th dat ...

  9. 战地记者也在使用Scrum

    2011年埃及骚乱 2011年1月25日开始,埃及人民由于不满物价上涨.失业率高和腐败等问题,埃及多个城市发生民众大规模集会,要求总统穆巴拉克下台.本来这只是一场小规模的抗议活动,却如星火燎原般点燃了 ...

  10. spring中bean 的属性id与name