作者:平凡小几 | 来源:互联网 | 2023-10-12 23:53
如果您使用的是ConnectorJ的8.x版,您可能会注意到生成器尝试为MySql信息模式(sys,information_schema,performance_schema等)中的表生成代码。
如果您使用的是Connector / J的8.x版,您可能会注意到生成器尝试为MySql信息模式(sys,information_schema,performance_schema等)中的表生成代码。这可能不是您想要的! 要禁用此行为,请将属性“nullCatalogMeansCurrent = true”添加到JDBC
下面颜色标准的就是8.0.11驱动容易漏掉的,
driverClass="com.mysql.cj.jdbc.Driver"
cOnnectionURL="jdbc:mysql://localhost:3306/logistics?useUnicode=true&characterEncoding=utf8
&serverTimezOne=GMT&nullCatalogMeansCurrent = true"
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>
<context id="context1">
<commentGenerator>
<property name="suppressAllComments" value="true"/>
<property name="suppressDate" value="true"/>
commentGenerator>
<jdbcConnection connectionURL="jdbc:mysql://localhost:3306/logistics?useUnicode=true&characterEncoding=utf-8&serverTimezOne=GMT&nullCatalogMeansCurrent = true" driverClass="com.mysql.cj.jdbc.Driver" password="gzsxt" userId="root" />
<javaModelGenerator targetPackage="cn.sxt.logistic.pojo" targetProject="mybatis-generator/src" />
<sqlMapGenerator targetPackage="cn.sxt.logistic.mapper" targetProject="mybatis-generator/src" />
<javaClientGenerator targetPackage="cn.sxt.logistic.mapper" targetProject="mybatis-generator/src" type="XMLMAPPER" />
<table tableName="user" domainObjectName="User" enableCountByExample="true" enableDeleteByExample="false" enableSelectByExample="true" enableUpdateByExample="false">table>
<table tableName="role" domainObjectName="Role" enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="true" enableUpdateByExample="false">table>
<table tableName="permission" domainObjectName="Permission" enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="true" enableUpdateByExample="false">table>
context>
generatorConfiguration>