mybatisplus自动生成修复
This commit is contained in:
1 parent
62f8d1ed38
commit
6c08edf199
1 file changed
-92
@@ -1,92 +0,0 @@
|
|||||||
//package com.ruoyi.generator;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//import com.baomidou.mybatisplus.generator.AutoGenerator;
|
|
||||||
//import com.baomidou.mybatisplus.generator.AutoGenerator;
|
|
||||||
//import com.baomidou.mybatisplus.generator.InjectionConfig;
|
|
||||||
//import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
|
|
||||||
//import com.baomidou.mybatisplus.generator.config.GlobalConfig;
|
|
||||||
//import com.baomidou.mybatisplus.generator.config.PackageConfig;
|
|
||||||
//import com.baomidou.mybatisplus.generator.config.StrategyConfig;
|
|
||||||
//import com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert;
|
|
||||||
//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 org.junit.Test;
|
|
||||||
//
|
|
||||||
//import java.util.HashMap;
|
|
||||||
//import java.util.Map;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * 自动生成
|
|
||||||
// */
|
|
||||||
//public class EntityGenerator {
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void entityGenerator() {
|
|
||||||
// AutoGenerator mpg = new AutoGenerator();
|
|
||||||
//
|
|
||||||
// // 全局配置
|
|
||||||
// GlobalConfig gc = new GlobalConfig();
|
|
||||||
// gc.setOutputDir("E:\\java\\Supply\\ruoyi-api\\src\\main\\java");//这里写你自己的java目录
|
|
||||||
// gc.setFileOverride(true);//是否覆盖
|
|
||||||
// gc.setActiveRecord(true);
|
|
||||||
// gc.setEnableCache(false);// XML 二级缓存
|
|
||||||
// gc.setBaseResultMap(true);// XML ResultMap
|
|
||||||
// gc.setBaseColumnList(false);// XML columList
|
|
||||||
// gc.setAuthor("hupeng");
|
|
||||||
// mpg.setGlobalConfig(gc);
|
|
||||||
//
|
|
||||||
// // 数据源配置
|
|
||||||
// DataSourceConfig dsc = new DataSourceConfig();
|
|
||||||
// dsc.setDbType(DbType.MYSQL);
|
|
||||||
// dsc.setTypeConvert(new MySqlTypeConvert() {
|
|
||||||
// // 自定义数据库表字段类型转换【可选】
|
|
||||||
// @Override
|
|
||||||
// public DbColumnType processTypeConvert(String fieldType) {
|
|
||||||
// return super.processTypeConvert(fieldType);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// dsc.setDriverName("com.mysql.jdbc.Driver");
|
|
||||||
// dsc.setUsername("root");
|
|
||||||
// dsc.setPassword("root");
|
|
||||||
// dsc.setUrl("jdbc:mysql://127.0.0.1:3306/ruoyi?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8");
|
|
||||||
// mpg.setDataSource(dsc);
|
|
||||||
//
|
|
||||||
// // 策略配置
|
|
||||||
// StrategyConfig strategy = new StrategyConfig();
|
|
||||||
// //strategy.setTablePrefix(new String[]{"_"});// 此处可以修改为您的表前缀
|
|
||||||
// strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
|
|
||||||
// strategy.setInclude(new String[]{"store_order",});
|
|
||||||
// mpg.setStrategy(strategy);
|
|
||||||
//
|
|
||||||
// // 包配置
|
|
||||||
// PackageConfig pc = new PackageConfig();
|
|
||||||
// pc.setParent(null);
|
|
||||||
// pc.setEntity("com.ruoyi.app.common.persistence.model");
|
|
||||||
// pc.setMapper("com.ruoyi.app.common.persistence.dao");
|
|
||||||
// pc.setXml("com.ruoyi.app.common.persistence.dao.mapping");
|
|
||||||
// pc.setService("TTT"); //本项目没用,生成之后删掉
|
|
||||||
// pc.setServiceImpl("TTT"); //本项目没用,生成之后删掉
|
|
||||||
// pc.setController("TTT"); //本项目没用,生成之后删掉
|
|
||||||
// mpg.setPackageInfo(pc);
|
|
||||||
//
|
|
||||||
// // 注入自定义配置,可以在 VM 中使用 cfg.abc 设置的值
|
|
||||||
// InjectionConfig cfg = new InjectionConfig() {
|
|
||||||
// @Override
|
|
||||||
// public void initMap() {
|
|
||||||
// Map<String, Object> map = new HashMap<>();
|
|
||||||
// map.put("abc", this.getConfig().getGlobalConfig().getAuthor() + "-mp");
|
|
||||||
// this.setMap(map);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// mpg.setCfg(cfg);
|
|
||||||
//
|
|
||||||
// // 执行生成
|
|
||||||
// mpg.execute();
|
|
||||||
//
|
|
||||||
// // 打印注入设置
|
|
||||||
// System.err.println(mpg.getCfg().getMap().get("abc"));
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
Reference in new issue
Block a user