Last active
January 28, 2019 09:12
-
-
Save Tjlastnumber/544728e7687ffb75c56bc84ebf499ad4 to your computer and use it in GitHub Desktop.
mybatis generate config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE generatorConfiguration | |
| PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" | |
| "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> | |
| <generatorConfiguration> | |
| <!-- 引入配置文件 --> | |
| <properties resource="db.properties"/> | |
| <classPathEntry location="${jdbc.classPath}"/> | |
| <context id="default" targetRuntime="MyBatis3" > | |
| <!-- 生成的pojo,将implements Serializable--> | |
| <plugin type="org.mybatis.generator.plugins.SerializablePlugin"/> | |
| <commentGenerator> | |
| <!-- 是否去除自动生成的注释 true:是 : false:否 --> | |
| <property name="suppressAllComments" value="true" /> | |
| </commentGenerator> | |
| <!-- jdbc连接 --> | |
| <jdbcConnection driverClass="${jdbc.driver}" | |
| connectionURL="${jdbc.url}" userId="${jdbc.username}" | |
| password="${jdbc.password}" /> | |
| <!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和 | |
| NUMERIC 类型解析为java.math.BigDecimal --> | |
| <javaTypeResolver> | |
| <property name="forceBigDecimals" value="false" /> | |
| </javaTypeResolver> | |
| <!-- targetProject:生成PO类的位置 --> | |
| <javaModelGenerator targetPackage="com.virtual.pojo" | |
| targetProject="src\main\java"> | |
| <!-- enableSubPackages:是否让schema作为包的后缀 --> | |
| <property name="enableSubPackages" value="false" /> | |
| <!-- 从数据库返回的值被清理前后的空格 --> | |
| <property name="trimStrings" value="true" /> | |
| </javaModelGenerator> | |
| <!-- targetProject:mapper映射文件生成的位置 --> | |
| <sqlMapGenerator targetPackage="com.virtual.dao" | |
| targetProject="src\main\java"> | |
| <!-- enableSubPackages:是否让schema作为包的后缀 --> | |
| <property name="enableSubPackages" value="false" /> | |
| </sqlMapGenerator> | |
| <!-- targetPackage:mapper接口生成的位置 --> | |
| <javaClientGenerator type="XMLMAPPER" | |
| targetPackage="com.virtual.dao" | |
| targetProject="src\main\java"> | |
| <!-- enableSubPackages:是否让schema作为包的后缀 --> | |
| <property name="enableSubPackages" value="false" /> | |
| </javaClientGenerator> | |
| <!-- 用户表 --> | |
| <table schema="score" tableName="score" | |
| enableCountByExample="false" | |
| enableDeleteByExample="false" | |
| enableSelectByExample="false" | |
| enableUpdateByExample="false"> | |
| </table> | |
| <table schema="user" tableName="user" | |
| enableCountByExample="false" | |
| enableDeleteByExample="false" | |
| enableSelectByExample="false" | |
| enableUpdateByExample="false"> | |
| </table> | |
| </context> | |
| </generatorConfiguration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <plugins> | |
| <plugin> | |
| <groupId>org.springframework.boot</groupId> | |
| <artifactId>spring-boot-maven-plugin</artifactId> | |
| </plugin> | |
| <plugin> | |
| <groupId>org.mybatis.generator</groupId> | |
| <artifactId>mybatis-generator-maven-plugin</artifactId> | |
| <version>1.3.5</version> | |
| <configuration> | |
| <verbose>true</verbose> | |
| <overwrite>true</overwrite> | |
| </configuration> | |
| </plugin> | |
| </plugins> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment