zoukankan      html  css  js  c++  java
  • Mybatis的逆向工程,MySQL8的数据库,8.0.11驱动的逆向工程的坑的解决方法

    如果您使用的是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&amp;characterEncoding=utf-8&amp;serverTimezone=GMT&amp;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" />
        
        <!-- ANNOTATEDMAPPER
         XMLMAPPER
         -->
        
        <!-- 操作接口 -->
        <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>
  • 相关阅读:
    sql ''增删改'' 笔记
    表单
    html基础
    第一本书的总结
    带参
    字符串
    zookeeper入门与实践
    node中间层转发请求
    npm脚本传参问题
    docker入门笔记
  • 原文地址:https://www.cnblogs.com/406070989senlin/p/11198788.html
Copyright © 2011-2022 走看看