![](https://csdnimg.cn/release/download_crawler_static/85418527/bg5.jpg)
<generatedKey column="ID" sqlStatement="SELECT
S_TBL_PRACTICE.NEXTVAL AS ID FROM DUAL"/>
</table>
</context>
</generatorConfiguration>
运行 bulid-mybatis.xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<project default="genfiles" basedir=".">
<property name="generated.source.dir" value="${basedir}" />
<target name="genfiles" description="Generate the files">
<taskdef name="mbgenerator"
classname="org.mybatis.generator.ant.GeneratorAntTask" classpath="mars-mybatis-generator-
core-1.3.2.jar" />
<mbgenerator overwrite="true" configfile="marsGeneratorConfig.xml"
verbose="false">
<propertyset>
<propertyref name="generated.source.dir" />
</propertyset>
</mbgenerator>
</target>
</project>
自动生成 domain 文件
com.newheyd.practice.domain.Practice.java com.newheyd.practice.domain.PracticeExample.java
自动生成 dao 文件
com.newheyd.practice.dao.PracticeMapper.java
PracticeMapper extends IMapper DAO 接口继承 IMapper 接口 DAO 中的接口实现类即可自动被 mybatis 注册
自动生成数据库映射文件 config.mapper.practice.PracticeMapper.xml
service
service 接口
package com.newheyd.practice.service;
public interface IPracticeService {
public int insert(Practice practice);
public int update(Practice practice);