新的Excel 格式
This commit is contained in:
parent
7d32bb98f3
commit
15a0b5e4d8
@ -63,7 +63,8 @@ public abstract class ICreator {
|
|||||||
public static Engine engine = Engine.use();
|
public static Engine engine = Engine.use();
|
||||||
|
|
||||||
public static Map<String, String> cateRelation = Kv.of("varchar", "String").set("text", "String").set("int", "Integer").set("bigint", "Long").set("long", "Long").set(null, "String").set("datetime", "Date");
|
public static Map<String, String> cateRelation = Kv.of("varchar", "String").set("text", "String").set("int", "Integer").set("bigint", "Long").set("long", "Long").set(null, "String").set("datetime", "Date");
|
||||||
public static String[] fields = {"field","cate", "must","remark1", "remark2", "tag", "selects", "column","filter", "ck", "edit","update","xqzs"};
|
//public static String[] fields = {"field","cate", "must","remark1", "remark2", "tag", "selects", "column","filter", "ck", "edit","update","xqzs"};
|
||||||
|
public static String[] fields = {"field", "remark1", "cate", "must", "remark2"};
|
||||||
public static Gson gson = new Gson();
|
public static Gson gson = new Gson();
|
||||||
|
|
||||||
public static List<String> sheetNames() {
|
public static List<String> sheetNames() {
|
||||||
@ -130,7 +131,7 @@ public abstract class ICreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isMust(Map map) {
|
public static boolean isMust(Map map) {
|
||||||
return false;//(map.get("must")+"") .equals("是") || (map.get("must")+"").equals("必须");
|
return (map.get("must")+"") .equals("是") || (map.get("must")+"").equals("必须");
|
||||||
}
|
}
|
||||||
public static boolean isEmpty(Object obj){
|
public static boolean isEmpty(Object obj){
|
||||||
return obj == null || (obj+"").isEmpty();
|
return obj == null || (obj+"").isEmpty();
|
||||||
@ -163,7 +164,7 @@ public abstract class ICreator {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
protected static String getClazzName(Map note) {
|
protected static String getClazzName(Map note) {
|
||||||
String field = note.get("field")+"";
|
/*String field = note.get("field")+"";
|
||||||
if (field.isEmpty()) return "";
|
if (field.isEmpty()) return "";
|
||||||
|
|
||||||
|
|
||||||
@ -174,6 +175,8 @@ public abstract class ICreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
field = field.substring(0, inx).toLowerCase();
|
field = field.substring(0, inx).toLowerCase();
|
||||||
|
*/
|
||||||
|
String field = (note.get("remark1")+"").trim();
|
||||||
String[] arr = field.split("_");
|
String[] arr = field.split("_");
|
||||||
String str = "";
|
String str = "";
|
||||||
for (String s : arr) {
|
for (String s : arr) {
|
||||||
@ -183,15 +186,16 @@ public abstract class ICreator {
|
|||||||
}
|
}
|
||||||
//{field:"ti_abc(测试表)"} => 测试表
|
//{field:"ti_abc(测试表)"} => 测试表
|
||||||
protected static String getRemark(Map note) {
|
protected static String getRemark(Map note) {
|
||||||
String field = note.get("field")+"";
|
/*String field = note.get("field")+"";
|
||||||
if (field.isEmpty()) return "";
|
if (field.isEmpty()) return "";
|
||||||
|
|
||||||
int s = field.indexOf("(");
|
int s = field.indexOf("(");
|
||||||
int e = field.indexOf(")");
|
int e = field.indexOf(")");
|
||||||
if (s > 0){
|
if (s > 0){
|
||||||
return field.substring(s+1, e > 0 ? e : field.length());
|
return field.substring(s+1, e > 0 ? e : field.length());
|
||||||
}
|
}*/
|
||||||
return "";
|
System.out.println(note.get("field")+"");
|
||||||
|
return note.get("field")+"";
|
||||||
}
|
}
|
||||||
protected static String getVerify(Map map) {
|
protected static String getVerify(Map map) {
|
||||||
if (map.get("cate") == null){
|
if (map.get("cate") == null){
|
||||||
|
@ -119,7 +119,7 @@ public class Runner {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
infoBuf.append("\t\t==> "+ k + "\n");
|
infoBuf.append("\t\t==> "+ k + "\t"+ ICreator.getTableName(clazz) + "\n");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,8 @@ public class SqlKit extends ICreator {
|
|||||||
x.put("isMust", isMust(x));
|
x.put("isMust", isMust(x));
|
||||||
//x.put("fieldType", this.getFieldType(x.get("cate")+""));
|
//x.put("fieldType", this.getFieldType(x.get("cate")+""));
|
||||||
x.put("fieldType", x.get("cate"));
|
x.put("fieldType", x.get("cate"));
|
||||||
x.put("remark", x.get("remark1"));
|
//x.put("remark", x.get("remark1"));
|
||||||
|
x.put("remark", "["+ x.get("remark1") + "]"+ (isEmpty(x.get("remark2")) ? "" : x.get("remark2")));
|
||||||
});
|
});
|
||||||
|
|
||||||
Kv kv = createTplData(clazz);
|
Kv kv = createTplData(clazz);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
##(remark)
|
##(remark)
|
||||||
# drop table if exists `#(tableName)`;
|
drop table if exists `#(tableName)`;
|
||||||
CREATE TABLE `#(tableName)` (
|
CREATE TABLE `#(tableName)` (
|
||||||
`id` bigint(20) auto_increment comment '主键',
|
|
||||||
#for(x : fieldList)
|
#for(x : fieldList)
|
||||||
#set(
|
#set(
|
||||||
field=x.field
|
field=x.field
|
||||||
@ -13,7 +12,7 @@ CREATE TABLE `#(tableName)` (
|
|||||||
`#(field)` #(x.fieldType) #(isMust) #(autoIncrement) comment '#(x.remark)',
|
`#(field)` #(x.fieldType) #(isMust) #(autoIncrement) comment '#(x.remark)',
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`#(fieldList[0].field)`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 comment '#(remark)';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 comment '#(remark)';
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user