java110 4 éve%!(EXTRA string=óta)
szülő
commit
582dc3fac2

+ 12 - 13
java110-generator/src/main/java/com/java110/code/TableToJsonWeb.java

@@ -7,14 +7,13 @@ import com.java110.utils.util.StringUtil;
 public class TableToJsonWeb {
 
     //show create table c_orders  用这个语句获取
-    public static final String createTableSql = "CREATE TABLE `fee_print_page` (\n" +
-            "  `page_id` varchar(30) NOT NULL COMMENT '页面ID',\n" +
-            "  `page_name` varchar(128) NOT NULL COMMENT '名称',\n" +
+    public static final String createTableSql = "CREATE TABLE `meter_type` (\n" +
+            "  `type_id` varchar(30) NOT NULL COMMENT '类型ID',\n" +
+            "  `type_name` varchar(12) NOT NULL COMMENT '名称',\n" +
             "  `community_id` varchar(30) NOT NULL COMMENT '小区ID',\n" +
-            "  `page_url` varchar(512) NOT NULL COMMENT '收据页面',\n" +
-            "  `state` varchar(12) NOT NULL DEFAULT 'F' COMMENT '状态 T 有效 F为无效',\n" +
+            "  `remark` varchar(200) DEFAULT NULL COMMENT '说明',\n" +
             "  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',\n" +
-            "  `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态 1表示 失效 0 有效'\n" +
+            "  `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,0, 在用 1失效'\n" +
             ")";
 
     public static void main(String[] args) {
@@ -60,10 +59,10 @@ public class TableToJsonWeb {
             }
             String comment = rowSql.contains("COMMENT") ? rowSql.substring(rowSql.indexOf("COMMENT '") + 9) : StringUtil.lineToHump(key);
             comment = comment.trim();
-            if(comment.contains(",")){
+            if (comment.contains(",")) {
                 comment = comment.split(",")[0];
             }
-            if(comment.contains(" ")){
+            if (comment.contains(" ")) {
                 comment = comment.split(" ")[0];
             }
             paramColumn.put("desc", comment);
@@ -74,10 +73,10 @@ public class TableToJsonWeb {
                 condition.put("code", StringUtil.lineToHump(key));
                 condition.put("whereCondition", "equal");
                 conditions.add(condition);
-                paramColumn.put("desc", "必填,"+comment);
+                paramColumn.put("desc", "必填," + comment);
             }
-            String limit = rowSql.substring(rowSql.indexOf("(") + 1,rowSql.indexOf(")"));
-            if(limit.contains(",")){
+            String limit = rowSql.substring(rowSql.indexOf("(") + 1, rowSql.indexOf(")"));
+            if (limit.contains(",")) {
                 limit = limit.split(",")[0];
             }
 
@@ -87,8 +86,8 @@ public class TableToJsonWeb {
             paramColumn.put("hasDefaultValue", false);
             paramColumn.put("inputType", "input");
             paramColumn.put("limit", "maxLength");
-            paramColumn.put("limitParam",limit );
-            paramColumn.put("limitErrInfo", comment+"不能超过"+limit);
+            paramColumn.put("limitParam", limit);
+            paramColumn.put("limitErrInfo", comment + "不能超过" + limit);
             paramColumn.put("show", true);
             paramColumns.add(paramColumn);
         }

+ 27 - 46
java110-generator/src/main/resources/web/template_1.json

@@ -1,37 +1,17 @@
 {
-  "templateName":"收据模板",
+  "templateKeyName": "抄表类型",
+  "templateName": "抄表类型",
+  "searchName": "抄表类型",
   "directories": "property",
-  "templateCode":"feePrintPage",
-  "templateKey":"pageId",
-  "templateKeyName":"收据ID",
-  "searchCode": "pageId",
-  "searchName": "收据ID",
-  "conditions": [
-    {
-      "whereCondition": "equal",
-      "code": "pageId",
-      "name": "页面ID",
-      "inputType": "input"
-    },
-    {
-      "whereCondition": "equal",
-      "code": "pageName",
-      "name": "名称",
-      "inputType": "input"
-    },
-    {
-      "whereCondition": "equal",
-      "code": "state",
-      "name": "状态",
-      "inputType": "input"
-    }
-  ],
+  "searchCode": "typeId",
+  "templateCode": "meterType",
+  "templateKey": "typeId",
   "columns": [
     {
       "hasDefaultValue": false,
-      "limitParam": "128",
-      "code": "pageName",
-      "limitErrInfo": "名称不能超过128",
+      "limitParam": "12",
+      "code": "typeName",
+      "limitErrInfo": "名称不能超过12",
       "cnCode": "名称",
       "limit": "maxLength",
       "show": true,
@@ -41,28 +21,29 @@
     },
     {
       "hasDefaultValue": false,
-      "limitParam": "30",
-      "code": "communityId",
-      "limitErrInfo": "小区ID不能超过30",
-      "cnCode": "小区ID",
+      "limitParam": "200",
+      "code": "remark",
+      "limitErrInfo": "说明不能超过200",
+      "cnCode": "说明",
       "limit": "maxLength",
       "show": true,
       "inputType": "input",
       "required": true,
-      "desc": "必填,小区ID"
+      "desc": "说明"
+    }
+  ],
+  "conditions": [
+    {
+      "whereCondition": "equal",
+      "code": "typeId",
+      "name": "类型ID",
+      "inputType": "input"
     },
     {
-      "hasDefaultValue": false,
-      "limitParam": "512",
-      "code": "pageUrl",
-      "limitErrInfo": "收据页面不能超过512",
-      "cnCode": "收据页面",
-      "limit": "maxLength",
-      "show": true,
-      "inputType": "input",
-      "required": true,
-      "desc": "必填,收据页面"
+      "whereCondition": "equal",
+      "code": "typeName",
+      "name": "名称",
+      "inputType": "input"
     }
   ]
-
-}
+}