• 草稿


    1.在pom.xml中引入mybatis自动生成代码插件

        <build>
            <plugins>
                <!-- mybatis generator 自动生成代码插件 -->
                <plugin>
                    <groupId>org.mybatis.generator</groupId>
                    <artifactId>mybatis-generator-maven-plugin</artifactId>
                    <version>1.3.2</version>
                    <configuration>
                        <verbose>true</verbose>
                        <overwrite>true</overwrite>
                    </configuration>
                </plugin>
            </plugins>
        </build>

    2.

    generatorConfig.xml的内容如下:

    <?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:apache-maven-3.5.0LocalMavenRepositorymysqlmysql-connector-java5.1.38mysql-connector-java-5.1.38.jar" />
        <context id="context1">
            <commentGenerator>
                <property name="suppressAllComments" value="true" /><!-- 是否取消注释 -->
                <property name="suppressDate" value="true" /> <!-- 是否生成注释代时间戳 -->
            </commentGenerator>
            <jdbcConnection driverClass="com.mysql.jdbc.Driver"
                            connectionURL="jdbc:mysql://localhost:3306/jianwu" userId="qukan"
                            password="quk_live123" />
            <!-- 实体-->
            <javaModelGenerator targetPackage="com.jianwu.win.entity"
                                targetProject="F:jianwutestWinsrcmainjava" />
            <!--mapper.xml-->
            <sqlMapGenerator targetPackage="com.jianwu.win.dao"
                             targetProject="F:jianwutestWinsrcmainjava" />
            <!--mapper.java-->
            <javaClientGenerator targetPackage="com.jianwu.win.dao"
                                 targetProject="F:jianwutestWinsrcmainjava" type="XMLMAPPER" />
    
            <table schema="jianwu" tableName="user"
                   enableCountByExample="false" enableSelectByExample="false"
                   enableDeleteByExample="false" enableUpdateByExample="false">
            </table>
    
        </context>
    </generatorConfiguration>

    然后刷新下就会出现

    双击生成代码

  • 相关阅读:
    近两年目标
    Spring使用ajax异步上传文件
    java注解
    js 点击文本框,预览选择图片
    修改服务器系统时间(包括hive)
    队列原理
    EMR目录
    2个CDH的hive数据同步
    CDH建表字符集问题
    EMR的fair-scheduler.xml
  • 原文地址:https://www.cnblogs.com/ENU7/p/9481911.html
Copyright © 2020-2023  润新知