zoukankan      html  css  js  c++  java
  • idea一键生成mybatis工具

    1、创建maven项目,导包

    <build>
            <plugins>
                <plugin>
                    <groupId>org.mybatis.generator</groupId>
                    <artifactId>mybatis-generator-maven-plugin</artifactId>
                    <version>1.3.5</version>
                    <configuration>
                        <verbose>true</verbose>
                        <overwrite>true</overwrite>
                        <configurationFile>E:hibernatesrcmain
    esourcesmybatisgeneratorConfig.xml</configurationFile>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>mysql</groupId>
                            <artifactId>mysql-connector-java</artifactId>
                            <version>6.0.6</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </build>
    

     2、在resources下创建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>
        <context id="MySQL2Tables" targetRuntime="MyBatis3">
            <commentGenerator>
                <property name="suppressAllComments" value="true" />
                <property name="addRemarkComments" value="true" />
            </commentGenerator>
            <!--数据源-->
            <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
                            connectionURL="jdbc:mysql://10.147.255.18:3306/xq_core_jc1"
                            userId="xq_core_jc1"
                            password="xq_core_jc1">
            </jdbcConnection>
            <javaTypeResolver >
                <property name="forceBigDecimals" value="false" />
            </javaTypeResolver>
            <javaModelGenerator targetPackage="dto"
                                targetProject="E:hibernatesrcmainjava">
                <property name="enableSubPackages" value="false" />
                <property name="trimStrings" value="true" />
            </javaModelGenerator>
            <sqlMapGenerator targetPackage="mapper"
                             targetProject="E:hibernatesrcmainjava">
                <property name="enableSubPackages" value="true" />
            </sqlMapGenerator>
            <javaClientGenerator type="XMLMAPPER" targetPackage="dao"
                                 targetProject="E:hibernatesrcmainjava">
                <property name="enableSubPackages" value="true" />
            </javaClientGenerator>
            <table tableName="t_c_wh_monthly_bill" domainObjectName="TcWhMonthlyBill"/>
        </context>
    </generatorConfiguration>
    

     3、添加maven配置

    (mybatis-generator:generate -e)

    4、双击运行

    5、大功告成

  • 相关阅读:
    C# 函数
    截取字符串 超长 用冒号显示
    免费的webservice接口
    Visual Studio 2010扩展让JS与CSS实现折叠
    两个div同时滚动
    cn_office_professional_plus_2010_x86_515 安装激活方法解决方案64bit
    Info.plist配置相关文件访问权限
    iOS 同一个View识别单击和双击手势
    WKWebView简单使用
    TabBar背景颜色设置
  • 原文地址:https://www.cnblogs.com/jwdd/p/10906120.html
Copyright © 2011-2022 走看看