一、Maven配置文件中添加如下依赖

<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.7</version>
</dependency>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.4</version>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
</dependencies>
<configuration>
<verbose>true</verbose>
<overwrite>true</overwrite>
<configurationFile>${basedir}/src/main/resources/generatorConfig.xml</configurationFile>
</configuration>
</plugin>

二、添加generatorConfig.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 >
<!-- mysql jar 文件位置 -->
<classPathEntry location="F:/instrument\maven/.m2/repository/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar" />
<context id="store" targetRuntime="MyBatis3">
<commentGenerator>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true" />
<!-- 是否去除所有自动生成的文件的时间戳,默认为false -->
<!-- <property name="suppressDate" value="false"/> -->
</commentGenerator>
<!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
connectionURL="jdbc:mysql://127.0.0.1:3306/g"
userId="root"
password="root">
<!--<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://112.35.82.91:3360/benevolenceParking"
userId="renrenbang"
password="05377975333">-->
</jdbcConnection>
<!-- targetPackage:包名称(自定义) targetProject:项目路径(自定义) -->
<javaModelGenerator targetPackage="com.zblx.park.po" targetProject="src/main/java">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- 配置生成相应的实体Mapper.xml,对于Mapper3.X我们需要把type="XMLMAPPER" -->
<!-- targetPackage:包名称(自定义) targetProject:项目路径(自定义) -->
<sqlMapGenerator targetPackage="com.zblx.park.mapper" targetProject="src/main/java">
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<!-- 配置生成相应的接口类,对应与Mapper.xml中的一系列CRUD方法SQL语句 -->
<!-- targetPackage:包名称(自定义) targetProject:项目路径(自定义) -->
<javaClientGenerator targetPackage="com.zblx.park.dao" targetProject="src/main/java" type="XMLMAPPER">
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<!-- 用户表-->
<!--<table schema="benevolenceParking" tableName="parking" domainObjectName="Parking"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false"
>-->
<table schema="fruit" tableName="parking" domainObjectName="Parking"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false"
/>
<table schema="fruit" tableName="orders" domainObjectName="Orders"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false"
>
</table>
<table schema="fruit" tableName="car" domainObjectName="Car"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false"
>
</table>
<table schema="fruit" tableName="carlock" domainObjectName="CarLock"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false"
>
</table>
</context>
</generatorConfiguration>

最新文章

  1. 分布式中使用Redis实现Session共享(二)
  2. 诺基亚N900使用技巧
  3. 调用SAP函数创建寄售退货订单的时候报错:业务对象 BUS2032 是销售订单,销售凭证类别 H 是退货。
  4. __attribute__((packed))详解
  5. Lintcode: Sort Colors II
  6. openstack(liberty): devstack中的iniset/iniget函数分析
  7. linux中fork()函数详解
  8. PhpStorm 获取注册码
  9. 最短路径算法之四——SPFA算法
  10. C#_约束 实现可排序单链表
  11. CodeForces 645D Robot Rapping Results Report
  12. .NET防止重复提交数据
  13. Visual Studio 2017无法加载Visual Studio 2015创建的SharePoint解决方案
  14. EasyUI datagrid 的多条件查询
  15. 银盒子智慧餐厅硬件尺寸规格&amp;推荐机型
  16. C#做单元测试,如何查看输出的调试信息?
  17. c++ 中的数字和字符串的转换
  18. java8中ConcurrentHashMap
  19. matlab入门笔记(六):编程基础之M文件
  20. ansible 学习记录

热门文章

  1. Father Christmas flymouse
  2. POJ3352(连通分量缩点)
  3. CentOS虚拟机通过主机WIFI上网
  4. 利用d3js绘出环形百分比环
  5. SSO跨域 CodeProject
  6. c# 任务栏托盘图标鼠标进入MouseEnter和鼠标离开MouseLeave实现
  7. 干货:SEO长尾关键词优化方法和技巧
  8. C#Timer停不住
  9. 截图上传功能 imageAreaselect
  10. codeforces 352D - Jeff and Furik【期望dp】