官網
mbg:MyBatis Generator
路徑
依然是看著mbg 官網來看摊沉,畢竟這個骨骼是最理解的作者給的 :)
- Create and fill out a configuration file appropriately (see below for samples)
- Save the file in some convenient location (like \temp\generatorConfig.xml)
- Run MBG from the command line with a command like this:
java -jar mybatis-generator-core-x.x.x.jar -configfile \temp\generatorConfig.xml -overwrite
- This will tell MBG to run using your configuration file. It will also tell MBG to overwrite any existing Java or Kotlin files with the same name. If you want to save any existing files, then omit the -overwrite parameter. If there is a conflict, MBG will save the newly generated file with a unique name (e.g. MyClass.java.1).
- After running MBG, you will need to create or modify the standard MyBatis configuration make use of your newly generated code.
- 整體來說:
- classpath引入 mybatis-generator-core-x.x.x.jar
- 配置一個xml 生成配置文件
- 通過 ant maven ide javacode 調用mbg生成相應的代碼