【MyBatis】之 Mybatis-generator 配置文件使用通配符 % 时,会生成关于 mysql 信息表的 pojo 和 mapper

问题描述
<table schema="financial_leasing" tableName="%"
              enableCountByExample="false" enableUpdateByExample="false"
              enableDeleteByExample="false" enableSelectByExample="false"
              selectByExampleQueryId="false">
</table>

generatorConfig.xml 中配置了以上 代码段,本意:匹配 financial_leasing 数据库下的所有表, 然而发现生成了很多关于 MySQL 信息表的 pojo 和 mapper


部分截图如下图:
这里写图片描述

解决方法


只需在 jdbcConnection 下 添加

<property name="nullCatalogMeansCurrent" value="true"/>

这里写图片描述




参考资料


MyBatis
stack overflow

猜你喜欢

转载自blog.csdn.net/fanfan4569/article/details/81019205