Gradle 数据库表自动生成model/mapper代码工具(IDEA版)

准备工作:

        1 需下载Gradle的bin压缩包,地址:http://services.gradle.org/distributions/ 【切勿下载高版本,推荐4.8.1】

        2 从GIT上下载放置生成代码的Gradle->Mybatis-plus项目 git地址https://github.com/baomidou/mybatis-plus.git 【需要切换到2.x分支】

        3 相关入门教程 https://www.cnblogs.com/sunny3096/p/9013704.html

                                   https://www.cnblogs.com/liangzs/p/8855834.html

参考入门教程

        Idea打开Gradle项目的build.gradle文件即可,关键配置【gradle home地址要映射到下载bin压缩包的解压路径】 如图:

image_1cb6i957911fk1bcgnp8ng1vad6h.png-43.7kB

   导入且部署完项目后编译代码 如图:

        注意右边的gradle栏【如果下载4.8.1版本的gradle的bin包基本就没问题】,类似maven下载依赖jar包 如图:

那项目的基本配置就完成,下面要做的就是配置连接数据库的参数了,这有个Oracle的java代码:

/**
 * Copyright (c) 2011-2016, hubin (jobob@qq.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.baomidou.mybatisplus.test.generator;

import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.converts.OracleTypeConvert;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
import com.baomidou.mybatisplus.generator.config.rules.DbType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.util.Collections;
imp
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值