|
|
@ -84,8 +84,6 @@ public class GenerateCode {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//类名
|
|
|
|
//类名
|
|
|
|
String beanNameWithoutT = dsKit.toCamelCase(dsKit.capitalizeFirstLetter(table));
|
|
|
|
String beanNameWithoutT = dsKit.toCamelCase(dsKit.capitalizeFirstLetter(table));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> fields = new ArrayList<>();
|
|
|
|
List<String> fields = new ArrayList<>();
|
|
|
|
//字段信息
|
|
|
|
//字段信息
|
|
|
|
rs = stmt.executeQuery("show full columns from " + table);
|
|
|
|
rs = stmt.executeQuery("show full columns from " + table);
|
|
|
@ -197,7 +195,7 @@ public class GenerateCode {
|
|
|
|
arp.stop();
|
|
|
|
arp.stop();
|
|
|
|
hpPlugin.stop();
|
|
|
|
hpPlugin.stop();
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println(dsKit.getCurrentTimeStr() + " 恭喜,表" + tableNames + "代码已成功生成!");
|
|
|
|
System.out.println(dsKit.getCurrentTimeStr() + " 恭喜,表" + tableNames + "代码已成功生成!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void autoCodeFreeMaker(JSONObject jo) throws IOException, TemplateException {
|
|
|
|
public static void autoCodeFreeMaker(JSONObject jo) throws IOException, TemplateException {
|
|
|
@ -295,7 +293,7 @@ public class GenerateCode {
|
|
|
|
Writer out = new FileWriter(codePath + "/" + tableName + "_Controller.txt", StandardCharsets.UTF_8);
|
|
|
|
Writer out = new FileWriter(codePath + "/" + tableName + "_Controller.txt", StandardCharsets.UTF_8);
|
|
|
|
template.process(dataModel, out);
|
|
|
|
template.process(dataModel, out);
|
|
|
|
out.close();
|
|
|
|
out.close();
|
|
|
|
System.out.println("Controller层代码生成完毕。");
|
|
|
|
System.out.println(dsKit.getCurrentTimeStr() + " 1、Controller层代码生成完毕。");
|
|
|
|
|
|
|
|
|
|
|
|
//2、生成Model层代码
|
|
|
|
//2、生成Model层代码
|
|
|
|
// 加载模板
|
|
|
|
// 加载模板
|
|
|
@ -304,6 +302,6 @@ public class GenerateCode {
|
|
|
|
out = new FileWriter(codePath + "/" + tableName + "_Model.txt", StandardCharsets.UTF_8);
|
|
|
|
out = new FileWriter(codePath + "/" + tableName + "_Model.txt", StandardCharsets.UTF_8);
|
|
|
|
template.process(dataModel, out);
|
|
|
|
template.process(dataModel, out);
|
|
|
|
out.close();
|
|
|
|
out.close();
|
|
|
|
System.out.println("Model层代码生成完毕。");
|
|
|
|
System.out.println(dsKit.getCurrentTimeStr() + " 2、Model层代码生成完毕。");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|