• 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、大功告成

  • 相关阅读:
    简练软考知识点整理-项目采购管理简介
    简练软考知识点整理-项目风险管理简介
    SQL(replace)替换字段中指定的字符
    sh 脚本名字和./脚本名字有什么区别
    linux下tar命令解压到指定的目录
    查看文件MD5值
    Topo check failed. Mapred tasks exceed 1000000000
    cron表达式详解
    Linux下#!/usr/bin/env bash和#!/usr/bin/bash、#!/bin/bash的比较
    linux中seq命令用法
  • 原文地址:https://www.cnblogs.com/jwdd/p/10906120.html
Copyright © 2020-2023  润新知