在pom.xml下的<build>内加入:

 <build>

    <plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.7</version> <configuration>
<configurationFile>${basedir}/src/main/resources/generatorConfig.xml</configurationFile>
<overwrite>true</overwrite>
</configuration> <dependencies>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
</plugin>
</plugins> </build>

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>
<!--jdbc 驱动包,等-->
<!--<classPathEntry location="/Program Files/IBM/SQLLIB/java/db2java.zip" />--> <context id="sss" targetRuntime="MyBatis3Simple"> <commentGenerator>
<property name="suppressAllComments" value="true" />
</commentGenerator> <jdbcConnection driverClass="org.mariadb.jdbc.Driver"
connectionURL="jdbc:mariadb://localhost/employeedb"
userId="root"
password="666666">
</jdbcConnection> <javaModelGenerator targetPackage="com.nf147.manage.entity" targetProject="src\main\java">
<property name="trimStrings" value="true" />
</javaModelGenerator> <sqlMapGenerator targetPackage="mappers" targetProject="src\main\resources">
</sqlMapGenerator> <javaClientGenerator type="XMLMAPPER" targetPackage="com.nf147.manage.dao" targetProject="src\main\java">
</javaClientGenerator> <table tableName="staff"> 如果多个表把tableName="%" 改为百分号
 <property name="useActualColumnNames" value="true"/> </table> </context> </generatorConfiguration>

Mybatis 自动生成mapper文件的更多相关文章

  1. 使用mybatis-generator插件结合tk.mybatis自动生成mapper二三事

    本篇文章将介绍使用spring boot框架,引入mybatis-generator插件,结合tk.mybatis自动生成Mapper和Entity的一整套流程,其中包括最重要的踩坑与填坑.     ...

  2. 使用mybatis-generator插件结合tk.mybatis自动生成mapper

    本篇文章将介绍使用spring boot框架,引入mybatis-generator插件,结合tk.mybatis自动生成Mapper和Entity的一整套流程,其中包括最重要的踩坑与填坑.     ...

  3. mybatis自动生成mapper,dao映射文件

    利用Mybatis-Generator来帮我们自动生成mapper.xml文件,dao文件,model文件. 1.所需文件 关于Mybatis-Generator的下载可以到这个地址:https:// ...

  4. Mybatis自动生成xml文件、dao接口、实体类

    Mybatis可以通过逆向工程,实现自动生成xml文件.dao接口.实体类 以下使用的是Intellij Idea进行自动生成 一.首先,要在pom.xml中导入插件,在<build>中加 ...

  5. mybatis自动生成mapper和pojo

    1.在resources下新建generatorConfig.xml <?xml version="1.0" encoding="UTF-8"?> ...

  6. Mybatis逆向生成Mapper文件

    本文参考博客 http://blog.csdn.net/for_my_life/article/details/51228098 1. 在resources根目录下添加generator.proper ...

  7. Mybatis自动生成Xml文件,针对字段类型为text等会默认产生XXXXWithBlobs的方法问题

    默认情况下产生的Mapper.xml里面存在: 需要修改generatorConfiguration.xml,里面的table加属性,如: <table domainObjectName=&qu ...

  8. mybatis 自动生成xml文件配置

    http://blog.csdn.net/techbirds_bao/article/details/9233599/

  9. mybatis自动生成model、dao及对应的mapper.xml文件

    背景: 日常开发中,如果新建表,手动敲写model.dao和对应的mapper.xml文件,费时费力且容易出错, 所以采用mybatis自动生成model.dao及对应的mapper.xml文件.代码 ...

随机推荐

  1. Gantt与PERT图区别

    甘特图也就做进度管理图.他是一种简单的水平条形图,它以日历为基准描述项目任务,水平轴表示日历时间线,每一个线条表示一个任务,任务名称垂直的列在左边列中,图中的线条的起点和终点对应水平轴上的时间,分别表 ...

  2. python的类属性、实例属性、类方法、静态方法

    类属性 就像如下代码: class Person: name = "张三" # 共有类属性 __age = 18 # 私有类属性 在类中直接定义的属性就是类属性,它被所有的实例对象 ...

  3. Python 进阶篇

    作者:武沛齐 出处:http://www.cnblogs.com/wupeiqi/articles/5246483.html Model 到目前为止,当我们的程序涉及到数据库相关操作时,我们一般都会这 ...

  4. 剑指offer-1:旋转数组的最小数字

    旋转数组的最小数字1.题目描述 把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转. 输入一个非减排序的数组的一个旋转,输出旋转数组的最小元素. 例如数组{3,4,5,1,2}为{1,2 ...

  5. Maven项目构建利器04——Maven的一些核心概念

    1.坐标 1)数学上的坐标: [1].在平面上. 使用X,Y两个向量可以唯一的定位平面上的任意一个点 [2]在空间中, 使用X,Y,Z三个向量可以唯一的定位空间中的任何一个点 2)Maven中的坐标: ...

  6. 安装最新版本的kubernets(+安装插件dashboard)

    一.安装docker // 安装系统工具: sudo yum install -y yum-utils device-mapper-persistent-data lvm2 // 添加docker y ...

  7. ARIMA模型

    ARIMA模型(英语:Autoregressive Integrated Moving Average model),差分整合移动平均自回归模型,又称整合移动平均自回归模型(移动也可称作滑动),时间序 ...

  8. Python 输出百分比

    注:python3环境试验 0x00 使用参数格式化{:2%} {:.2%}: 显示小数点后2位 print('{:.2%}'.format(10/50)) #percent: 20.00% {:.0 ...

  9. docker命令(随时补充)

    导入导出容器:https://blog.csdn.net/LEoe_/article/details/78685156 拷贝文件到容器内:docker cp 本地路径 容器长ID:容器路径

  10. Xunsearch入门

    Xunsearch入门 简介: 开源免费.高性能.多功能.简单易用的专业全文检索技术方案. 1.Xunsearch安装: (1)官网(http://xunsearch.com)下载 wget http ...