|
|
|
@ -102,6 +102,7 @@ public class GenerateCode {
|
|
|
|
|
//记录主键
|
|
|
|
|
if (rs.getString("Key").equals("PRI")) {
|
|
|
|
|
jo.put("key", Field);
|
|
|
|
|
jo.put("key_type", dataTypeMap.get(Type));
|
|
|
|
|
} else {//否则记录到map中
|
|
|
|
|
map.put(Field, dataTypeMap.get(Type));
|
|
|
|
|
}
|
|
|
|
@ -246,25 +247,51 @@ public class GenerateCode {
|
|
|
|
|
//表的描述
|
|
|
|
|
String comment = jo.getStr("comment");
|
|
|
|
|
|
|
|
|
|
//主键
|
|
|
|
|
String key = jo.getStr("key");
|
|
|
|
|
String key_type = jo.getStr("key_type");
|
|
|
|
|
|
|
|
|
|
//1、增加
|
|
|
|
|
StringBuilder sbAdd = new StringBuilder();
|
|
|
|
|
sbAdd.append(" //增加" + comment + "\n");
|
|
|
|
|
sbAdd.append(" @Before({POST.class})\n");
|
|
|
|
|
sbAdd.append(" //@JwtCheckInterface({})\n");
|
|
|
|
|
sbAdd.append(" //@EmptyInterface({\"\"})\n");
|
|
|
|
|
sbAdd.append(" //@IsNumericInterface({})\n");
|
|
|
|
|
sbAdd.append(" public void add" + beanName + "(" + fullParameters + "){\n");
|
|
|
|
|
sbAdd.append(" model.add"+beanName+"("+parameters+")\n");
|
|
|
|
|
sbAdd.append(" renderJson(RetKit.renderSuccess(\"操作成功\"));\n");
|
|
|
|
|
sbAdd.append(" }\n");
|
|
|
|
|
|
|
|
|
|
System.out.println(sbAdd);
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
sb.append(" //增加" + comment + "\n");
|
|
|
|
|
sb.append(" @Before({POST.class})\n");
|
|
|
|
|
sb.append(" //@JwtCheckInterface({})\n");
|
|
|
|
|
sb.append(" //@EmptyInterface({\"\"})\n");
|
|
|
|
|
sb.append(" //@IsNumericInterface({})\n");
|
|
|
|
|
sb.append(" public void add" + beanName + "(" + fullParameters + "){\n");
|
|
|
|
|
sb.append(" model.add" + beanName + "(" + parameters + ")\n");
|
|
|
|
|
sb.append(" renderJson(RetKit.renderSuccess(\"操作成功\"));\n");
|
|
|
|
|
sb.append(" }\n");
|
|
|
|
|
|
|
|
|
|
//2、删除
|
|
|
|
|
sb.append("\n");
|
|
|
|
|
sb.append(" //按ID删除" + comment + "\n");
|
|
|
|
|
sb.append(" @Before({POST.class})\n");
|
|
|
|
|
sb.append(" //@JwtCheckInterface({})\n");
|
|
|
|
|
sb.append(" //@EmptyInterface({\"\"})\n");
|
|
|
|
|
sb.append(" //@IsNumericInterface({\"id\"})\n");
|
|
|
|
|
sb.append(" public void del" + beanName + "ById(" + key_type + " " + key + "){\n");
|
|
|
|
|
sb.append(" model.del" + beanName + "ById(" + key + ");\n");
|
|
|
|
|
sb.append(" renderJson(RetKit.renderSuccess(\"操作成功\"));\n");
|
|
|
|
|
sb.append(" }\n");
|
|
|
|
|
|
|
|
|
|
//3、修改
|
|
|
|
|
sb.append("\n");
|
|
|
|
|
sb.append(" //按ID修改" + comment + "\n");
|
|
|
|
|
sb.append(" @Before({POST.class})\n");
|
|
|
|
|
sb.append(" //@JwtCheckInterface({})\n");
|
|
|
|
|
sb.append(" //@EmptyInterface({\"\"})\n");
|
|
|
|
|
sb.append(" //@IsNumericInterface({\"id\"})\n");
|
|
|
|
|
sb.append(" public void update" + beanName + "ById(" + key_type + " " + key + "," + fullParameters + "){\n");
|
|
|
|
|
sb.append(" model.update" + beanName + "ById(" + parameters + ");\n");
|
|
|
|
|
sb.append(" renderJson(RetKit.renderSuccess(\"操作成功\"));\n");
|
|
|
|
|
sb.append(" }\n");
|
|
|
|
|
sb.append("\n");
|
|
|
|
|
|
|
|
|
|
//4、单条查询
|
|
|
|
|
|
|
|
|
|
//5、分页查询
|
|
|
|
|
|
|
|
|
|
System.out.println(sb);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|