mybatis-generator/target/classes/generatorConfig.xml

42 lines
2.0 KiB
XML
Raw Permalink Normal View History

2024-06-14 16:58:54 +08:00
<!DOCTYPE generatorConfiguration PUBLIC
"-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!-- MyBatis3Simple风格 -->
<context id="simple" targetRuntime="MyBatis3Simple">
<property name="javaFileEncoding" value="UTF-8"/>
<!--生成mapper.xml时覆盖原文件-->
<plugin type="org.mybatis.generator.plugins.UnmergeableXmlMappersPlugin"/>
<commentGenerator>
<!-- 是否去除自动生成的注释 true false:否。 自动生成注释太啰嗦可以编码扩展CommentGenerator -->
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!-- 数据库连接 -->
<jdbcConnection driverClass="org.postgresql.Driver"
connectionURL="jdbc:postgresql://192.168.9.238:5432/longhuan?currentSchema=user"
userId="postgres" password="123456">
<!-- 设置为true就只读取db_book下的表, 否则会优先读取到mysql的user表 -->
<property name="nullCatalogMeansCurrent" value="true"/>
</jdbcConnection>
<!-- 生成PO的包名和位置 -->
<javaModelGenerator targetPackage="com.longhuan.dao.pojo" targetProject="src/main/java"/>
<!-- 生成XML映射文件的包名和位置 -->
<sqlMapGenerator targetPackage="com.longhuan.dao.mapper" targetProject="src/main/resources"/>
<!-- 生成Mapper接口的包名和位置 -->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.longhuan.dao.mapper" targetProject="src/main/java"/>
<!-- 要生成对应表配置 -->
<table tableName="user" domainObjectName="User" >
<!-- 自增主键列 -->
<generatedKey column="id" sqlStatement="MYSQL" identity="true"/>
<!-- tinyint映射为Integer -->
<columnOverride column="role" javaType="Integer" jdbcType="TINYINT"/>
</table>
</context>
</generatorConfiguration>