zoukankan      html  css  js  c++  java
  • mybatis链接mysql8.0以上版本数据库的逆向工程配置

    mybatis链接mysql8.0以上版本数据库的逆向工程配置两种xml文件配置方案:

     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
     3 <generatorConfiguration>
     4   <context id="context1">
     5    <!-- 注释构建 -->
     6     <commentGenerator>
     7        <!-- 去掉所有的注释 -->
     8         <property name="suppressAllComments" value="true"/>
     9         <property name="suppressDate" value="true"/>
    10     </commentGenerator>
    11     
    12     <!-- 数据库四要素 -->
    13     <jdbcConnection connectionURL="jdbc:mysql://localhost:3306/gz_logistics?serverTimezone=UTC&amp;characterEncoding=utf-8&amp;useSSL=false" driverClass="com.mysql.cj.jdbc.Driver" password="myroot" userId="root" />
    14     <!-- 实体类  -->
    15     <javaModelGenerator targetPackage="top.abcdit.gzlogistics.pojo" targetProject="mybatis-generator/src" />
    16     <!-- 映射文件 -->
    17     <sqlMapGenerator targetPackage="top.abcdit.gzlogistics.mapper" targetProject="mybatis-generator/src" />
    18     
    19     <!-- ANNOTATEDMAPPER
    20         XMLMAPPER
    21      -->
    22     
    23     <!-- 操作接口 -->
    24     <javaClientGenerator  targetPackage="top.abcdit.gzlogistics.mapper" targetProject="mybatis-generator/src" type="XMLMAPPER" />
    25     <table  tableName="tb_user"  domainObjectName="Tb_user"  enableCountByExample="true" enableDeleteByExample="false" enableSelectByExample="true" enableUpdateByExample="false"></table>
    26     <table  tableName="r_role" domainObjectName="R_role" enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="true" enableUpdateByExample="false"></table>
    27     <table  tableName="P_permission"  domainObjectName="P_permission" enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="true" enableUpdateByExample="false"></table>
    28   </context>
    29 </generatorConfiguration>

    或者

    <?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/gz_logistics?useUnicode=true&amp;characterEncoding=utf-8&amp;serverTimezone=GMT&amp;nullCatalogMeansCurrent = true" 
          driverClass
    ="com.mysql.cj.jdbc.Driver" password="myroot" userId="root" /> <!-- 实体类 --> <javaModelGenerator targetPackage="top.abcdit.gzlogistics.pojo" targetProject="mybatis-generator/src" /> <!-- 映射文件 --> <sqlMapGenerator targetPackage="top.abcdit.gzlogistics.mapper" targetProject="mybatis-generator/src" /> <!-- ANNOTATEDMAPPER XMLMAPPER --> <!-- 操作接口 --> <javaClientGenerator targetPackage="top.abcdit.gzlogistics.mapper" targetProject="mybatis-generator/src" type="XMLMAPPER" /> <table tableName="tb_user" domainObjectName="Tb_user" enableCountByExample="true" enableDeleteByExample="false" enableSelectByExample="true" enableUpdateByExample="false"></table> <table tableName="r_role" domainObjectName="R_role" enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="true" enableUpdateByExample="false"></table> <table tableName="P_permission" domainObjectName="P_permission" enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="true" enableUpdateByExample="false"></table> </context> </generatorConfiguration>
  • 相关阅读:
    .NET Framework Execution Was Aborted By Escalation Policy
    语句获取作业属性、历史记录
    Login failed知多少
    数据库代理错误日志
    微信小程序资料
    时间进度条,根据时间,显示任务进度条
    两个select 左右添加,上下移动
    图片轮播无缝接
    CSS3简单的栅格系统
    JavaScript DOM节点和文档类型
  • 原文地址:https://www.cnblogs.com/abcdjava/p/11198142.html
Copyright © 2011-2022 走看看