1.使用 mybatis-generator 工具生成项目所需文件
<?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>
<context id="MysqlTables" targetRuntime="MyBatis3">
<!-- 生成的Java文件的编码 -->
<property name="javaFileEncoding" value="UTF-8"/>
<!-- 增加Models ToStirng方法 -->
<plugin type="org.mybatis.generator.plugins.ToStringPlugin"/>
<!-- 增加Models Serializable实现 -->
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>
<!-- 分页插件 -->
<!-- 在example类中增 page 属性,并在mapper.xml的查询中加入page !=null 时的查询 -->
<!-- <plugin type="org.mybatis.generator.plugins.MySQLPagerPlugin" /> -->
<!-- 在example类中增 offset和limit属性,并在mapper.xml的查询中加入limit ${offset} , ${limit} 提供在offset和limit>0时的查询 -->
<!-- <plugin type="org.mybatis.generator.plugins.MySQLPaginationPlugin"></plugin> -->
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<commentGenerator>
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!-- mysql数据库连接配置 --></