官方文档参考:
MyBatis Generator Core -- Running MyBatis Generator With Maven
java
mysql 中数据表创建后,使用BGM 逆向生成mybatis 相关文件
执行命令:
mvn mybatis-generator:generator
如果报错如下:
[ERROR] Could not find goal 'generator' in plugin org.mybatis.generator:mybatis-generator-maven-plugin:1.3.7 among available goals generate, help -> [Help 1]
需要更换如下命令
项目下执行:
mvn -Dmybatis.generator.overwrite=true mybatis-generator:generate
过程log:
...
[INFO] Generating Example class for table tfts_tcdb_nre
[INFO] Generating Record class for table tfts_tcdb_nre
[INFO] Generating Mapper Interface for table tfts_tcdb_nre
[INFO] Generating SQL Map for table tfts_tcdb_nre
...
[INFO] Saving file TftsTcdbNreMapper.xml // 生成于 ~/src/resource/.../mapper
....
[INFO] Saving file TftsTcdbNreExample.java // 生成于 ~/src/main/.../po
[INFO] Saving file TftsTcdbNre.java // 生成于 ~/src/main/.../po
[INFO] Saving file TftsTcdbNreMapper.java // 生成于 ~/src/main/.../mapper
.....