• 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>
  • 相关阅读:
    【设计模式(17)】行为型模式之中介者模式
    服务器迁移--MySQL数据库迁移
    巧妙解决element-ui下拉框选项过多的问题
    关于后台返回的文件流下载方法
    关于input框只让输入数字的写法
    关于element ui 全局配置某些组件的属性方法
    关于echarts的南丁格尔玫瑰图 极值导致展示效果不好的解决方案
    mock数据的使用方法
    配置 git账号和邮箱
    vite 发布了正式版版了 用起来
  • 原文地址:https://www.cnblogs.com/406070989senlin/p/11198788.html
Copyright © 2020-2023  润新知