1.在pom.xml文件中添加mybatis-generator插件
<!-- geelynote maven的核心插件之-complier插件默认只支持编译Java 1.4,因此需要加上支持高版本jre的配置,在pom.xml里面加上 增加编译插件 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7</source> <target>1.7</target> <encoding>UTF-8</encoding> <compilerArguments> <extdirs>${project.basedir}/src/main/webapp/WEB-INF/lib</extdirs> </compilerArguments> </configuration> </plugin>
2.在resource目录下新建mybatis-generater-config文件, 配置mysql数据库驱动包及其配置信息, 以及pojo / xml / interface 生成器及 表-模型对应信息
3.刷新idea右侧maven, 双击mybatis-generator进行生成
4.如果数据表中有时间戳, 可将updatetime按需求进行修改