• 一款好用的Mybatis自动生成文件工具


    用了好几年,确实好用,今天写个文档mark一下,以免下次又找不到了。

    文件下载地址:

    简单三步,轻轻松松生成文件:

    1. 把plugins中的所有jar拷贝到eclipse的plugins文件夹之中
    2. 把features中的所有文件夹拷贝到eclipse的features文件夹之中
    3. 重启eclipse,ok

    附上generator.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>
    <!-- 指定mysql的驱动包的路径(禁止放在有中文的目录下) -->
    <classPathEntry
    location="D://maven//maven-dependcies//m2//repository//mysql//mysql-connector-java//5.1.46//mysql-connector-java-5.1.46.jar" />

    <!-- 配置数据源和生成代码所存放的位置 -->
    <context id="cont" targetRuntime="MyBatis3">
    <commentGenerator>
    <!-- 抑制警告 -->
    <property name="suppressTypeWarnings" value="true" />
    <!-- 是否去除自动生成的注释 true:是 : false:否 -->
    <property name="suppressAllComments" value="true" />
    <!-- 是否生成注释代时间戳 -->
    <property name="suppressDate" value="true" />
    </commentGenerator>

    <!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
    <jdbcConnection driverClass="com.mysql.jdbc.Driver"
    connectionURL="数据库地址"
    userId="用户名" password="密码" />
    <!-- 所生成实体类的位置默认的资源包 -->
    <javaModelGenerator
    targetPackage="com.demo.model"
    targetProject="Demo">
    <property name="enableSubPackages" value="false" />
    <property name="trimStrings" value="true" />
    </javaModelGenerator>

    <!-- 所生成的sqlmap的映射文件的位置,默认资源包src -->
    <sqlMapGenerator
    targetPackage="com.demo.mapper"
    targetProject="Demo">
    <property name="enableSubPackages" value="true" />
    </sqlMapGenerator>

    <javaClientGenerator type="XMLMAPPER"
    targetPackage="com..mapper" targetProject="merchant-open-api">
    <property name="enableSubPackages" value="true" />
    </javaClientGenerator>

    <!-- 为哪些表生成映射文件 tableName:表名 schema:写空即可 -->
    <table schema="" tableName="表名" enableCountByExample="false"
    domainObjectName="User" enableUpdateByExample="false" enableDeleteByExample="false"
    enableSelectByExample="false" selectByExampleQueryId="false">
    </table>

    </context>
    </generatorConfiguration>

    配置好,右键项目名称:

  • 相关阅读:
    implement a plus b / a minus b without using any arithmetic operators
    The month's days(leap year defination)
    sort algorithm
    js数组去重
    rabbitmq环境安装
    线程池
    课外加餐:4 | 页面性能工具:如何使用 Performance?
    课外加餐:5 | 性能分析工具:如何分析Performance中的Main指标?
    结束语
    课外加餐:6 | HTTPS:浏览器如何验证数字证书?
  • 原文地址:https://www.cnblogs.com/lucky-girl/p/10606346.html
Copyright © 2020-2023  润新知