Project Structure
If the project uses the relational database, cooperate with the Ibatis use, only needs to establish the database table to be OK, other will give the plug-in to do. Add in 1.pom file
<build>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactid >mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
< Configuration>
<configurationFile>${basedir}/src/main/resources/generator/generatorConfig.xml< /configurationfile>
<overwrite>true</overwrite>
<verbose>true</verbose>
</configuration>
</plugin>
</plugins>
</build>
2. Add a configuration file to the resources
Resource
|____generator
| |____generatorconfig.xml
<?xml version= "1.0" encoding= "UTF-8"?> <! DOCTYPE generatorconfiguration Public "-//mybatis.org//dtd mybatis generator Configuration" "1.0//en S.org/dtd/mybatis-generator-config_1_0.dtd "> <!--usage: MVN mybatis-generator:generate--> < Generatorconfiguration> <!--Read the configuration file address--> <properties resource= "application-test.properties"/> <!- -Connection driver to determine the address--> <classpathentry location= "/users/liuxin/desktop/postgresql-42.0.0.jre6 2.jar"/> <contex T id= "Context1" targetruntime= "Mybatis3simple" defaultmodeltype= "flat" > <property name= "Beginningdelimiter" Value= "" "/> <property name=" endingdelimiter "value=" '/> <jdbcconnection ' driverclass= Tgresql.
Driver "Connectionurl=" ${druid.url} "userid=" ${druid.username} " Password= "${druid.password}" > </jdbcConnection> <!--entity classes are also not built in advance, and willAutomatically according to the database generation, the corresponding database field--> <javamodelgenerator targetpackage= "Pterosaur.account.domain" targetproject= "src/main/" Java "/> <!--mapped mapper.xml files--> <sqlmapgenerator targetpackage=" mapper "targetproject=" Src/main /resources "/> <!--mapping file, the target does not need to be built ahead of time and automatically generates--> <javaclientgenerator targetpackage=" Pterosaur.account . Mapper "targetproject=" Src/main/java "type=" Xmlmapper "/> <!--input indicates that the table name does not correspond to the entity Dynamic judgment--> <table tablename= "Boluome_flow" ></table> <table tablename= "Boluome_refund_flow" & gt;</table> <table tablename= "boluome_refund_seettlement" ></table> <table tablename= " Boluome_settlement "></table> <table tablename=" Boss_settlement_account "></table> < Table Tablename= "Boss_transaction_flow" ></table> <table tablename= "Settlement_account" ></table&
Gt <table tablEname= "User_settlement_account" ></table> <table tablename= "User_transcation_flow" ></table> </context> </generatorConfiguration>