java110 лет назад: 4
Родитель
Сommit
2926d12eb0

+ 16 - 15
java110-generator/src/main/java/com/java110/code/TableToJsonWeb.java

@@ -7,25 +7,26 @@ import com.java110.utils.util.StringUtil;
 public class TableToJsonWeb {
 
     //show create table c_orders  用这个语句获取
-    public static final String createTableSql = "CREATE TABLE `report_custom` (\n" +
-            "  `custom_id` varchar(30) NOT NULL COMMENT '报表编号',\n" +
-            "  `group_id` varchar(30) NOT NULL COMMENT '组编号',\n" +
-            "  `title` varchar(64) NOT NULL COMMENT '选项标题',\n" +
-            "  `seq` int(11) NOT NULL COMMENT '排序',\n" +
+    public static final String createTableSql = "CREATE TABLE `report_custom_component` (\n" +
+            "  `component_id` varchar(30) NOT NULL COMMENT '组件ID',\n" +
+            "  `name` varchar(64) NOT NULL COMMENT '组件名称',\n" +
+            "  `component_group` varchar(12) NOT NULL DEFAULT 'C' COMMENT '组件组',\n" +
+            "  `component_type` varchar(12) NOT NULL COMMENT '组件类型',\n" +
+            "  `query_model` varchar(1) NOT NULL COMMENT '查询方式',\n" +
+            "  `sql` longtext(1024) COMMENT '执行sql',\n" +
+            "  `java_script`  longtext(1024) COMMENT '执行java脚本代码',\n" +
             "  `remark` varchar(512) DEFAULT NULL COMMENT '描述',\n" +
-            "  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',\n" +
-            "  `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效'\n" +
-            ")";
+            "  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间'\n" +
+            ") ";
 
     public static void main(String[] args) {
-        String templateName = "报表"; //业务名称
-        String templateCode = "reportCustom"; //表名大写
-        String templateKey = "customId"; //表主键
-        String templateKeyName = "报表ID";//主键说明
-        String searchCode = "customId"; //分片字段
-        String searchName = "报表ID"; //分片字段说明
+        String templateName = "报表组件"; //业务名称
+        String templateCode = "reportCustomComponent"; //表名大写
+        String templateKey = "componentId"; //表主键
+        String templateKeyName = "组件ID";//主键说明
+        String searchCode = "componentId"; //分片字段
+        String searchName = "组件ID"; //分片字段说明
         String directories = "dev"; //前端生成到那个目录下
-
         // templateName 业务名称 业务编码名称生成后文件名 templateCode 主键 templateKey
         // 业务主键名称 templateKeyName=templateName+ID 主机驼峰 searchCode 主键名称 searchName
         // directories 放在前端那个目录下

+ 45 - 33
java110-generator/src/main/resources/web/template_1.json

@@ -1,54 +1,66 @@
 {
-  "templateKeyName": "报表ID",
-  "templateName": "报表",
+  "templateKeyName": "组件ID",
+  "templateName": "报表组件",
   "columns": [
     {
       "hasDefaultValue": false,
-      "limitParam": "30",
-      "code": "customId",
-      "limitErrInfo": "报表编号不能超过30",
-      "cnCode": "报表编号",
+      "limitParam": "64",
+      "code": "name",
+      "limitErrInfo": "组件名称不能超过64",
+      "cnCode": "组件名称",
       "limit": "maxLength",
       "show": true,
       "inputType": "input",
       "required": true,
-      "desc": "必填,报表编号"
+      "desc": "必填,组件名称"
     },
     {
       "hasDefaultValue": false,
-      "limitParam": "30",
-      "code": "groupId",
-      "limitErrInfo": "组编号不能超过30",
-      "cnCode": "组编号",
+      "limitParam": "12",
+      "code": "componentType",
+      "limitErrInfo": "组件类型不能超过12",
+      "cnCode": "组件类型",
       "limit": "maxLength",
       "show": true,
       "inputType": "input",
       "required": true,
-      "desc": "必填,组编号"
+      "desc": "必填,组件类型"
     },
     {
       "hasDefaultValue": false,
-      "limitParam": "64",
-      "code": "title",
-      "limitErrInfo": "选项标题不能超过64",
-      "cnCode": "选项标题",
+      "limitParam": "1",
+      "code": "queryModel",
+      "limitErrInfo": "查询方式不能超过1",
+      "cnCode": "查询方式",
       "limit": "maxLength",
       "show": true,
       "inputType": "input",
       "required": true,
-      "desc": "必填,选项标题"
+      "desc": "必填,查询方式"
     },
     {
       "hasDefaultValue": false,
-      "limitParam": "11",
-      "code": "seq",
-      "limitErrInfo": "排序不能超过11",
-      "cnCode": "排序",
+      "limitParam": "1024",
+      "code": "sql",
+      "limitErrInfo": "执行sql不能超过1024",
+      "cnCode": "执行sql",
       "limit": "maxLength",
       "show": true,
       "inputType": "input",
-      "required": true,
-      "desc": "必填,排序"
+      "required": false,
+      "desc": "执行sql"
+    },
+    {
+      "hasDefaultValue": false,
+      "limitParam": "1024",
+      "code": "javaScript",
+      "limitErrInfo": "执行java脚本代码不能超过1024",
+      "cnCode": "执行java脚本代码",
+      "limit": "maxLength",
+      "show": true,
+      "inputType": "input",
+      "required": false,
+      "desc": "执行java脚本代码"
     },
     {
       "hasDefaultValue": false,
@@ -63,29 +75,29 @@
       "desc": "描述"
     }
   ],
-  "searchName": "报表ID",
+  "searchName": "组件ID",
   "directories": "dev",
-  "searchCode": "customId",
-  "templateCode": "reportCustom",
+  "searchCode": "componentId",
+  "templateCode": "reportCustomComponent",
   "conditions": [
     {
       "whereCondition": "equal",
-      "code": "customId",
-      "name": "报表编号",
+      "code": "componentId",
+      "name": "组件ID",
       "inputType": "input"
     },
     {
       "whereCondition": "equal",
-      "code": "groupId",
-      "name": "组编号",
+      "code": "name",
+      "name": "组件名称",
       "inputType": "input"
     },
     {
       "whereCondition": "equal",
-      "code": "title",
-      "name": "选项标题",
+      "code": "componentType",
+      "name": "组件类型",
       "inputType": "input"
     }
   ],
-  "templateKey": "customId"
+  "templateKey": "componentId"
 }

+ 1 - 1
service-report/src/main/java/com/java110/report/cmd/reportCustomComponent/SaveReportCustomComponentCmd.java

@@ -55,7 +55,6 @@ public class SaveReportCustomComponentCmd extends AbstractServiceCmdListener {
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "name", "请求报文中未包含name");
-        Assert.hasKeyAndValue(reqJson, "componentGroup", "请求报文中未包含componentGroup");
         Assert.hasKeyAndValue(reqJson, "componentType", "请求报文中未包含componentType");
         Assert.hasKeyAndValue(reqJson, "queryModel", "请求报文中未包含queryModel");
 
@@ -67,6 +66,7 @@ public class SaveReportCustomComponentCmd extends AbstractServiceCmdListener {
 
         ReportCustomComponentPo reportCustomComponentPo = BeanConvertUtil.covertBean(reqJson, ReportCustomComponentPo.class);
         reportCustomComponentPo.setComponentId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
+        reportCustomComponentPo.setComponentGroup("C");
         int flag = reportCustomComponentV1InnerServiceSMOImpl.saveReportCustomComponent(reportCustomComponentPo);
 
         if (flag < 1) {