| 
					
				 | 
			
			
				@@ -0,0 +1,294 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+package com.usky.uskyfire.web.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.baomidou.mybatisplus.core.toolkit.StringPool; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.baomidou.mybatisplus.generator.AutoGenerator; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.baomidou.mybatisplus.generator.InjectionConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.baomidou.mybatisplus.generator.config.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.baomidou.mybatisplus.generator.config.po.TableInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.io.File; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @author yq 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @date 2021/7/6 11:42 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+public class MybatisGeneratorUtils { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static void main(String[] args) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String table = "uaaaa"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        shell("",table); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        shell1("",table); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        shell2("",table); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        shell3("",table); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static void shell(String model,String table) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AutoGenerator mpg = new AutoGenerator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //1、全局配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        GlobalConfig gc = new GlobalConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        File file = new File(model); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String path = file.getAbsolutePath(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setOutputDir(path + "/src/main/java");  //生成路径(一般都是生成在此项目的src/main/java下面) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改为自己的名字 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setAuthor("JCB"); //设置作者 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setOpen(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setFileOverride(true); //第二次生成会把第一次生成的覆盖掉 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setServiceName("%sService"); //生成的service接口名字首字母是否为I,这样设置就没有 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setBaseResultMap(true); //生成resultMap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setGlobalConfig(gc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //2、数据源配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改数据源 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DataSourceConfig dsc = new DataSourceConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setUrl("jdbc:mysql://101.133.214.75:3306/usky-fire?useUnicode=true&serverTimezone=GMT&useSSL=false&characterEncoding=utf8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setDriverName("com.mysql.cj.jdbc.Driver"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setUsername("usky"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setPassword("Yt#75Usky"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setDataSource(dsc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 3、包配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PackageConfig pc = new PackageConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setParent("com.usky.uskyfire.web"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setController("controller"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setEntity("model"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setMapper("persistence.mapper"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setService("service"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setServiceImpl("service.impl"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //pc.setModuleName("test"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setPackageInfo(pc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 4、策略配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        StrategyConfig strategy = new StrategyConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setNaming(NamingStrategy.underline_to_camel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setColumnNaming(NamingStrategy.underline_to_camel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        strategy.setSuperMapperClass("com.bizmatics.common.mvc.base.CrudMapper"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        strategy.setSuperServiceClass("com.bizmatics.common.mvc.base.CrudService"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        strategy.setSuperServiceImplClass("com.bizmatics.common.mvc.base.AbstractCrudService"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // strategy.setTablePrefix("t_"); // 表名前缀 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setEntityLombokModel(true); //使用lombok 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改自己想要生成的表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setInclude(new String[]{""+table+""});  // 逆向工程使用的表   如果要生成多个,这里可以传入String[] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setStrategy(strategy); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 关闭默认 xml 生成,调整生成 至 根目录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改对应的模块名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        TemplateConfig tc = new TemplateConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setController(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setEntity(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setService(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setServiceImpl(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 自定义配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        InjectionConfig cfg = new InjectionConfig() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            public void initMap() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // to do nothing 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //如果模板引擎是 velocity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String templatePath = "/templates/mapper.xml.vm"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 自定义输出配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<FileOutConfig> focList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 自定义配置会被优先输出 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        focList.add(new FileOutConfig(templatePath) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            public String outputFile(TableInfo tableInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!! 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return path + "/src/main/resources/mapper/mysql/" + "/" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        cfg.setFileOutConfigList(focList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setCfg(cfg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setXml(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setTemplate(tc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.execute(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static void shell1(String model,String table) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AutoGenerator mpg = new AutoGenerator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //1、全局配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        GlobalConfig gc = new GlobalConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        File file = new File(model); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String path = file.getAbsolutePath(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setOutputDir(path + "/src/main/java");  //生成路径(一般都是生成在此项目的src/main/java下面) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改为自己的名字 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setAuthor("JCB"); //设置作者 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setOpen(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setFileOverride(true); //第二次生成会把第一次生成的覆盖掉 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setServiceName("%sService"); //生成的service接口名字首字母是否为I,这样设置就没有 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setBaseResultMap(true); //生成resultMap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setGlobalConfig(gc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //2、数据源配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改数据源 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DataSourceConfig dsc = new DataSourceConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setUrl("jdbc:mysql://101.133.214.75:3306/usky-fire?useUnicode=true&serverTimezone=GMT&useSSL=false&characterEncoding=utf8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setDriverName("com.mysql.cj.jdbc.Driver"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setUsername("usky"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setPassword("Yt#75Usky"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setDataSource(dsc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 3、包配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PackageConfig pc = new PackageConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setParent("com.usky.uskyfire.web"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setController("controller"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setEntity("model"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setMapper("persistence.mapper"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setService("service"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setServiceImpl("service.impl"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //pc.setModuleName("test"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setPackageInfo(pc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 4、策略配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        StrategyConfig strategy = new StrategyConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setNaming(NamingStrategy.underline_to_camel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setColumnNaming(NamingStrategy.underline_to_camel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        strategy.setSuperMapperClass("com.bizmatics.common.mvc.base.CrudMapper"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        strategy.setSuperServiceClass("com.bizmatics.common.mvc.base.CrudService"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        strategy.setSuperServiceImplClass("com.bizmatics.common.mvc.base.AbstractCrudService"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // strategy.setTablePrefix("t_"); // 表名前缀 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setEntityLombokModel(true); //使用lombok 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改自己想要生成的表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setInclude(new String[]{""+table+""});  // 逆向工程使用的表   如果要生成多个,这里可以传入String[] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setStrategy(strategy); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 关闭默认 xml 生成,调整生成 至 根目录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改对应的模块名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        TemplateConfig tc = new TemplateConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setController(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setService(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setServiceImpl(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setMapper(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setXml(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setTemplate(tc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.execute(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static void shell2(String model,String table) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AutoGenerator mpg = new AutoGenerator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //1、全局配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        GlobalConfig gc = new GlobalConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        File file = new File(model); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String path = file.getAbsolutePath(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setOutputDir(path + "/src/main/java");  //生成路径(一般都是生成在此项目的src/main/java下面) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改为自己的名字 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setAuthor("JCB"); //设置作者 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setOpen(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setFileOverride(true); //第二次生成会把第一次生成的覆盖掉 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setServiceName("%sService"); //生成的service接口名字首字母是否为I,这样设置就没有 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setBaseResultMap(true); //生成resultMap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setGlobalConfig(gc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //2、数据源配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改数据源 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DataSourceConfig dsc = new DataSourceConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setUrl("jdbc:mysql://101.133.214.75:3306/usky-fire?useUnicode=true&serverTimezone=GMT&useSSL=false&characterEncoding=utf8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setDriverName("com.mysql.cj.jdbc.Driver"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setUsername("usky"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setPassword("Yt#75Usky"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setDataSource(dsc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 3、包配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PackageConfig pc = new PackageConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setParent("com.usky.uskyfire.web"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setController("controller"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setEntity("model"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setMapper("persistence.mapper"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setService("service"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setServiceImpl("service.impl"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //pc.setModuleName("test"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setPackageInfo(pc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 4、策略配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        StrategyConfig strategy = new StrategyConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setNaming(NamingStrategy.underline_to_camel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setColumnNaming(NamingStrategy.underline_to_camel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        strategy.setSuperMapperClass("com.bizmatics.common.mvc.base.CrudMapper"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        strategy.setSuperServiceClass("com.bizmatics.common.mvc.base.CrudService"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        strategy.setSuperServiceImplClass("com.bizmatics.common.mvc.base.AbstractCrudService"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // strategy.setTablePrefix("t_"); // 表名前缀 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setEntityLombokModel(true); //使用lombok 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改自己想要生成的表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setInclude(new String[]{""+table+""});  // 逆向工程使用的表   如果要生成多个,这里可以传入String[] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setStrategy(strategy); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 关闭默认 xml 生成,调整生成 至 根目录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改对应的模块名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        TemplateConfig tc = new TemplateConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setController(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setMapper(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setXml(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setEntity(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setTemplate(tc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.execute(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static void shell3(String model,String table) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AutoGenerator mpg = new AutoGenerator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //1、全局配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        GlobalConfig gc = new GlobalConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        File file = new File(model); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String path = file.getAbsolutePath(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setOutputDir(path + "/src/main/java");  //生成路径(一般都是生成在此项目的src/main/java下面) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改为自己的名字 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setAuthor("JCB"); //设置作者 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setOpen(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setFileOverride(true); //第二次生成会把第一次生成的覆盖掉 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setServiceName("%sService"); //生成的service接口名字首字母是否为I,这样设置就没有 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gc.setBaseResultMap(true); //生成resultMap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setGlobalConfig(gc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //2、数据源配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改数据源 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DataSourceConfig dsc = new DataSourceConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setUrl("jdbc:mysql://101.133.214.75:3306/usky-fire?useUnicode=true&serverTimezone=GMT&useSSL=false&characterEncoding=utf8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setDriverName("com.mysql.cj.jdbc.Driver"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setUsername("usky"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dsc.setPassword("Yt#75Usky"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setDataSource(dsc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 3、包配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PackageConfig pc = new PackageConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setParent("com.usky.uskyfire.web"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setController("controller"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setEntity("model"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setMapper("persistence.mapper"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setService("service"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pc.setServiceImpl("service.impl"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //pc.setModuleName("test"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setPackageInfo(pc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 4、策略配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        StrategyConfig strategy = new StrategyConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setNaming(NamingStrategy.underline_to_camel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setColumnNaming(NamingStrategy.underline_to_camel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        strategy.setSuperMapperClass("com.bizmatics.common.mvc.base.CrudMapper"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        strategy.setSuperServiceClass("com.bizmatics.common.mvc.base.CrudService"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        strategy.setSuperServiceImplClass("com.bizmatics.common.mvc.base.AbstractCrudService"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // strategy.setTablePrefix("t_"); // 表名前缀 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setEntityLombokModel(true); //使用lombok 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改自己想要生成的表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        strategy.setInclude(new String[]{""+table+""});  // 逆向工程使用的表   如果要生成多个,这里可以传入String[] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setStrategy(strategy); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 关闭默认 xml 生成,调整生成 至 根目录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //修改对应的模块名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        TemplateConfig tc = new TemplateConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setMapper(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setXml(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setService(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setServiceImpl(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tc.setEntity(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.setTemplate(tc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mpg.execute(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |