准备工作:
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压缩包的解压路径】 如图:
导入且部署完项目后编译代码 如图:
注意右边的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