zoukankan      html  css  js  c++  java
  • mybatis generator cmd 终端命令 生成dao model mapper

    mybatis generator cmd 终端命令 生成dao model mapper

    文件包下载
    generator.xml文件配置
    • 新建generator.xml文件
    • 配置如下:修改代码中D:generator 自己所放jar包路径、数据库链接地址,用户名、密码,以及需要生成文件对应的表名,保存即可
    <?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>  
        <!-- 数据库驱动包位置 -->  
        <classPathEntry location="F:MGmysql-connector-java-5.1.47.jar" />   
        <!-- <classPathEntry location="C:oracleproduct10.2.0db_1jdbclibojdbc14.jar" />-->  
        <context id="DB2Tables" targetRuntime="MyBatis3">  
            <commentGenerator>  
                <property name="suppressAllComments" value="true" />  
            </commentGenerator>  
            <!-- 数据库链接URL、用户名、密码 -->  
             <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/test?characterEncoding=utf8" userId="root" password="123456">   
            <!--<jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" connectionURL="jdbc:oracle:thin:@localhost:1521:orcl" userId="msa" password="msa">--> 
            </jdbcConnection>  
            <javaTypeResolver>  
                <property name="forceBigDecimals" value="false" />  
            </javaTypeResolver>  
            <!-- 生成模型的包名和位置 -->  
            <javaModelGenerator targetPackage="andy.model" targetProject="F:MGsrc">  
                <property name="enableSubPackages" value="true" />  
                <property name="trimStrings" value="true" />  
            </javaModelGenerator>  
            <!-- 生成的映射文件包名和位置 -->  
            <sqlMapGenerator targetPackage="andy.mapping" targetProject="F:MGsrc">  
                <property name="enableSubPackages" value="true" />  
            </sqlMapGenerator>  
            <!-- 生成DAO的包名和位置 -->  
            <javaClientGenerator type="XMLMAPPER" targetPackage="andy.dao" targetProject="F:MGsrc">  
                <property name="enableSubPackages" value="true" />  
            </javaClientGenerator>  
            <!-- 要生成那些表(更改tableName和domainObjectName就可以) -->  
            <table tableName="userinfo" domainObjectName="UserInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" />  
            <!-- <table tableName="course_info" domainObjectName="CourseInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" />  
            <table tableName="course_user_info" domainObjectName="CourseUserInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" /> -->  
        </context>  
    </generatorConfiguration>  
    
    命令执行
    • 目标文件目录下新建src文件夹
    • 终端进入对应文件目录
    • 输入命令:
      • java -jar mybatis-generator-core-1.3.7.jar -configfile generator.xml -overwrite
  • 相关阅读:
    STM32 IIC双机通信—— HAL库硬件IIC版
    利用 ST-LINK Utility软件下载程序
    STM32CubeMx的使用分享
    STM32 GPIO重映射(转)
    IIC 原理讲解
    STM32 软件模拟 IIC 代码,标准库、HAL库可用
    STM32 抢占优先级和响应优先级
    浅谈C中的malloc和free
    C语言-cout<<"123"<<"45"<<endl;
    VC6-Win7下VC++6.0打开多个工程的设置
  • 原文地址:https://www.cnblogs.com/frankltf/p/9613694.html
Copyright © 2011-2022 走看看