Browse Source

调整mapping 保存sql

吴学文 6 years ago
parent
commit
1248c900cc

+ 53 - 35
WebService/src/main/resources/components/service-manage/serviceManage.html

@@ -5,56 +5,74 @@
                 <div class="ibox-title">
                     <h5>服务信息</h5>
                     <div class="ibox-tools" style="top:10px;">
-                        <button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddServiceModal()">
-                            <i class="glyphicon glyphicon-plus"></i>
-                            添加服务
-                        </button>
+                        <form>
+                            <div class="form-row">
+                                <div class="col-8 input-group input-group-sm">
+                                    <input type="text" placeholder="请填写服务名称" class=" form-control" v-model="serviceManageInfo.name">
+                                    <div class="input-group-prepend">
+                                        <button type="button" class="btn btn-primary btn-sm"  v-on:click="_queryServiceMethod()">
+                                            <i class="glyphicon glyphicon-search"></i> 马上查询</button>
+                                    </div>
+                                </div>
+
+                                <div class="col">
+                                    <button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddServiceModal()">
+                                        <i class="glyphicon glyphicon-plus"></i>
+                                        添加服务
+                                    </button>
+                                </div>
+                            </div>
+                        </form>
+
                     </div>
                 </div>
                 <div class="ibox-content">
 
-                    <table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
+                    <table class="footable table table-stripped toggle-arrow-tiny"
+                           data-page-size="15"
+                           style="table-layout: fixed;word-break:break-all;"
+                    >
                         <thead>
                         <tr>
-                                                        <th>服务ID</th>
-                            <th>服务名称</th>
-                            <th>服务编码</th>
-                            <th>秘钥</th>
-                            <th>序列</th>
-                            <th>消息队列</th>
-                            <th>是否实例</th>
-                            <th>调用地址</th>
-                            <th>调用方式</th>
-                            <th>超时时间</th>
-                            <th>重试次数</th>
-                            <th>提供服务</th>
-                            <th class="text-right">操作</th>
+                            <th class="text-center">服务ID</th>
+                            <th class="text-center">服务名称</th>
+                            <th class="text-center">服务编码</th>
+                            <th class="text-center">秘钥</th>
+                            <th class="text-center">序列</th>
+                            <th class="text-center">消息队列</th>
+                            <th class="text-center">是否实例</th>
+                            <th class="text-center">调用地址</th>
+                            <th class="text-center">调用方式</th>
+                            <th class="text-center">超时时间</th>
+                            <th class="text-center">重试次数</th>
+                            <th class="text-center">提供服务</th>
+                            <th class="text-center">操作</th>
 
 
                         </tr>
                         </thead>
                         <tbody>
-                            <tr v-for="service in serviceManageInfo.services">
-                                                            <td>{{service.serviceId}}</td>
-                            <td>{{service.name}}</td>
-                            <td>{{service.serviceCode}}</td>
-                            <td>{{service.businessTypeCd}}</td>
-                            <td>{{service.seq}}</td>
-                            <td>{{service.messageQueueName}}</td>
-                            <td>{{service.isInstance}}</td>
-                            <td>{{service.url}}</td>
-                            <td>{{service.method}}</td>
-                            <td>{{service.timeout}}</td>
-                            <td>{{service.retryCount}}</td>
-                            <td>{{service.provideAppId}}</td>
-                            <td><div class="btn-group">
-                                    <button class="btn-white btn btn-xs" v-on:click="_openEditServiceModel(service)">修改</button>
-                                </div>
+                        <tr v-for="service in serviceManageInfo.services">
+                            <td class="text-center">{{service.serviceId}}</td>
+                            <td class="text-center">{{service.name}}</td>
+                            <td class="text-center">{{service.serviceCode}}</td>
+                            <td class="text-center">{{service.businessTypeCd}}</td>
+                            <td class="text-center">{{service.seq}}</td>
+                            <td class="text-center">{{service.messageQueueName}}</td>
+                            <td class="text-center">{{service.isInstance}}</td>
+                            <td class="text-center">{{service.url}}</td>
+                            <td class="text-center">{{service.method}}</td>
+                            <td class="text-center">{{service.timeout}}</td>
+                            <td class="text-center">{{service.retryCount}}</td>
+                            <td class="text-center">{{service.provideAppId}}</td>
+                            <td class="text-center"><div class="btn-group">
+                                <button class="btn-white btn btn-xs" v-on:click="_openEditServiceModel(service)">修改</button>
+                            </div>
                                 <div class="btn-group">
                                     <button class="btn-white btn btn-xs" v-on:click="_openDeleteServiceModel(service)">删除</button>
                                 </div></td>
 
-                            </tr>
+                        </tr>
                         </tbody>
                         <tfoot>
                         <tr>

+ 6 - 1
WebService/src/main/resources/components/service-manage/serviceManage.js

@@ -9,7 +9,8 @@
             serviceManageInfo:{
                 services:[],
                 total:0,
-                records:1
+                records:1,
+                name:''
             }
         },
         _initMethod:function(){
@@ -58,6 +59,10 @@
             },
             _openDeleteServiceModel:function(_service){
                 vc.emit('deleteService','openDeleteServiceModal',_service);
+            },
+            _queryServiceMethod:function(){
+                vc.component._listServices(DEFAULT_PAGE, DEFAULT_ROWS);
+
             }
         }
     });

+ 2 - 2
java110-code-generator/src/main/java/com/java110/code/BaseGenerator.java

@@ -76,7 +76,7 @@ public class BaseGenerator {
                 .replace("@@TemplateKey@@", toUpperCaseFirstOne(data.getString("templateKey")))
                 .replace("@@templateKeyName@@", data.getString("templateKeyName"))
                 .replace("@@TEMPLATECODE@@", data.getString("templateCode").toUpperCase())
-                .replace("@@searchCode@@", data.getString("searchCode").toUpperCase())
-                .replace("@@searchName@@", data.getString("searchName").toUpperCase());
+                .replace("@@searchCode@@", data.getString("searchCode"))
+                .replace("@@searchName@@", data.getString("searchName"));
     }
 }

+ 113 - 37
java110-code-generator/src/main/resources/web/template_1.json

@@ -1,71 +1,147 @@
 {
-  "templateName":"编码映射",
-  "templateCode":"mapping",
-  "templateKey":"id",
-  "templateKeyName":"编码ID",
+  "templateName":"服务",
+  "templateCode":"service",
+  "templateKey":"serviceId",
+  "templateKeyName":"服务ID",
   "searchCode": "name",
-  "searchName": "名称",
+  "searchName": "服务名称",
   "columns":[
     {
-      "code":"domain",
-      "cnCode":"",
-      "desc":"必填,请填写",
+      "code":"name",
+      "cnCode":"服务名称",
+      "desc":"必填,请填写服务名称",
       "required":true,
-      "hasDefaultValue":true,
-      "defaultValue":"DOMAIN.COMMON",
+      "hasDefaultValue":false,
       "inputType":"input",
       "limit":"maxLength",
       "limitParam":"50",
-      "limitErrInfo":"域长度不能超过50"
+      "limitErrInfo":"服务名称不能超过50"
     },
     {
-      "code":"name",
-      "cnCode":"名称",
-      "desc":"必填,请填写名称",
+      "code":"serviceCode",
+      "cnCode":"服务编码",
+      "desc":"必填,请填写服务编码如 service.saveService",
       "required":true,
       "hasDefaultValue":false,
       "inputType":"input",
       "limit":"maxin",
       "limitParam":"2,50",
-      "limitErrInfo":"名称必须在2至50字符之间"
+      "limitErrInfo":"服务编码必须在2至50字符之间"
     },
     {
-      "code":"key",
-      "cnCode":"",
-      "desc":"必填,请填写键",
+      "code":"businessTypeCd",
+      "cnCode":"秘钥",
+      "desc":"可填,请填写秘钥,如果填写了需要加密传输",
       "required":true,
-      "hasDefaultValue":false,
-      "defaultValue":"",
-      "inputType":"input",
+      "hasDefaultValue":true,
+      "defaultValue":"API",
+      "inputType":"none",
       "limit":"maxin",
-      "limitParam":"1,100",
-      "limitErrInfo":"键必须在1至100之间"
+      "limitParam":"2,4",
+      "limitErrInfo":"业务类型必须为API"
     },
 
     {
-      "code":"value",
-      "cnCode":"",
-      "desc":"必填,请填写",
+      "code":"seq",
+      "cnCode":"序列",
+      "desc":"必填,请填写序列",
       "required":true,
-      "hasDefaultValue":false,
-      "defaultValue":"",
-      "inputType":"input",
-      "limit":"maxin",
-      "limitParam":"1,100",
-      "limitErrInfo":"值必须在1至100之间"
+      "hasDefaultValue":true,
+      "defaultValue":"1",
+      "inputType":"none",
+      "limit":"maxLength",
+      "limitParam":"1",
+      "limitErrInfo":"序列格式错误"
     },
 
     {
-      "code":"remark",
-      "cnCode":"备注",
-      "desc":"可填,请填写备注",
+      "code":"messageQueueName",
+      "cnCode":"消息队列",
+      "desc":"可填,请填写消息队列,订单在异步调用时使用",
       "required":false,
       "hasDefaultValue":false,
       "defaultValue":"",
-      "inputType":"textarea",
+      "inputType":"input",
+      "limit":"maxLength",
+      "limitParam":"50",
+      "limitErrInfo":"消息队列不能超过50"
+    }
+  ,
+
+    {
+      "code":"isInstance",
+      "cnCode":"是否实例",
+      "desc":"可填,请填写实例 Y 或N",
+      "required":true,
+      "hasDefaultValue":true,
+      "defaultValue":"Y",
+      "inputType":"input",
+      "limit":"maxLength",
+      "limitParam":"50",
+      "limitErrInfo":"实例不能超过50"
+    }
+  ,
+
+    {
+      "code":"url",
+      "cnCode":"调用地址",
+      "desc":"可填,请填写调用地址",
+      "required":false,
+      "hasDefaultValue":true,
+      "defaultValue":"http://order-service/orderApi/service",
+      "inputType":"input",
       "limit":"maxLength",
       "limitParam":"200",
-      "limitErrInfo":"备注内容不能超过200"
+      "limitErrInfo":"调用地址不能超过200"
+    },
+    {
+      "code":"method",
+      "cnCode":"调用方式",
+      "desc":"必填,请填写调用方式",
+      "required":true,
+      "hasDefaultValue":false,
+      "inputType":"select",
+      "selectValue":"GET,POST",
+      "selectValueName":"http get,http post",
+      "limit":"maxLength",
+      "limitParam":"50",
+      "limitErrInfo":"调用方式不能超过50"
+    },
+    {
+      "code":"timeout",
+      "cnCode":"超时时间",
+      "desc":"必填,请填写超时时间",
+      "required":true,
+      "hasDefaultValue":true,
+      "defaultValue":"60",
+      "inputType":"input",
+      "limit":"num",
+      "limitParam":"",
+      "limitErrInfo":"超时时间必须为数字"
+    },
+    {
+      "code":"retryCount",
+      "cnCode":"重试次数",
+      "desc":"必填,请填写重试次数",
+      "required":true,
+      "hasDefaultValue":true,
+      "defaultValue":"3",
+      "inputType":"input",
+      "limit":"num",
+      "limitParam":"",
+      "limitErrInfo":"重试次数必须为数字"
+    },
+    {
+      "code":"provideAppId",
+      "cnCode":"提供服务",
+      "desc":"必填,请填写提供服务",
+      "required":true,
+      "hasDefaultValue":true,
+      "defaultValue":"8000418002",
+      "inputType":"none",
+      "limit":"num",
+      "limitParam":"",
+      "limitErrInfo":"重试次数必须为数字"
     }
 
   ]

+ 72 - 0
java110-code-generator/src/main/resources/web/template_mapping.json

@@ -0,0 +1,72 @@
+{
+  "templateName":"编码映射",
+  "templateCode":"mapping",
+  "templateKey":"id",
+  "templateKeyName":"编码ID",
+  "searchCode": "name",
+  "searchName": "名称",
+  "columns":[
+    {
+      "code":"domain",
+      "cnCode":"域",
+      "desc":"必填,请填写域",
+      "required":true,
+      "hasDefaultValue":true,
+      "defaultValue":"DOMAIN.COMMON",
+      "inputType":"input",
+      "limit":"maxLength",
+      "limitParam":"50",
+      "limitErrInfo":"域长度不能超过50"
+    },
+    {
+      "code":"name",
+      "cnCode":"名称",
+      "desc":"必填,请填写名称",
+      "required":true,
+      "hasDefaultValue":false,
+      "inputType":"input",
+      "limit":"maxin",
+      "limitParam":"2,50",
+      "limitErrInfo":"名称必须在2至50字符之间"
+    },
+    {
+      "code":"key",
+      "cnCode":"键",
+      "desc":"必填,请填写键",
+      "required":true,
+      "hasDefaultValue":false,
+      "defaultValue":"",
+      "inputType":"input",
+      "limit":"maxin",
+      "limitParam":"1,100",
+      "limitErrInfo":"键必须在1至100之间"
+    },
+
+    {
+      "code":"value",
+      "cnCode":"值",
+      "desc":"必填,请填写值",
+      "required":true,
+      "hasDefaultValue":false,
+      "defaultValue":"",
+      "inputType":"input",
+      "limit":"maxin",
+      "limitParam":"1,100",
+      "limitErrInfo":"值必须在1至100之间"
+    },
+
+    {
+      "code":"remark",
+      "cnCode":"备注",
+      "desc":"可填,请填写备注",
+      "required":false,
+      "hasDefaultValue":false,
+      "defaultValue":"",
+      "inputType":"textarea",
+      "limit":"maxLength",
+      "limitParam":"200",
+      "limitErrInfo":"备注内容不能超过200"
+    }
+
+  ]
+}

+ 0 - 146
java110-code-generator/src/main/resources/web/template_service.json

@@ -1,146 +0,0 @@
-{
-  "templateName":"服务",
-  "templateCode":"service",
-  "templateKey":"serviceId",
-  "templateKeyName":"服务ID",
-  "columns":[
-    {
-      "code":"name",
-      "cnCode":"服务名称",
-      "desc":"必填,请填写服务名称",
-      "required":true,
-      "hasDefaultValue":false,
-      "inputType":"input",
-      "limit":"maxLength",
-      "limitParam":"50",
-      "limitErrInfo":"服务名称不能超过50"
-    },
-    {
-      "code":"serviceCode",
-      "cnCode":"服务编码",
-      "desc":"必填,请填写服务编码如 service.saveService",
-      "required":true,
-      "hasDefaultValue":false,
-      "inputType":"input",
-      "limit":"maxin",
-      "limitParam":"2,50",
-      "limitErrInfo":"服务编码必须在2至50字符之间"
-    },
-    {
-      "code":"businessTypeCd",
-      "cnCode":"秘钥",
-      "desc":"可填,请填写秘钥,如果填写了需要加密传输",
-      "required":true,
-      "hasDefaultValue":true,
-      "defaultValue":"API",
-      "inputType":"none",
-      "limit":"maxin",
-      "limitParam":"2,4",
-      "limitErrInfo":"业务类型必须为API"
-    },
-
-    {
-      "code":"seq",
-      "cnCode":"序列",
-      "desc":"必填,请填写序列",
-      "required":true,
-      "hasDefaultValue":true,
-      "defaultValue":"1",
-      "inputType":"none",
-      "limit":"maxLength",
-      "limitParam":"1",
-      "limitErrInfo":"序列格式错误"
-    },
-
-    {
-      "code":"messageQueueName",
-      "cnCode":"消息队列",
-      "desc":"可填,请填写消息队列,订单在异步调用时使用",
-      "required":false,
-      "hasDefaultValue":false,
-      "defaultValue":"",
-      "inputType":"input",
-      "limit":"maxLength",
-      "limitParam":"50",
-      "limitErrInfo":"消息队列不能超过50"
-    }
-  ,
-
-    {
-      "code":"isInstance",
-      "cnCode":"是否实例",
-      "desc":"可填,请填写实例 Y 或N",
-      "required":true,
-      "hasDefaultValue":true,
-      "defaultValue":"Y",
-      "inputType":"input",
-      "limit":"maxLength",
-      "limitParam":"50",
-      "limitErrInfo":"实例不能超过50"
-    }
-  ,
-
-    {
-      "code":"url",
-      "cnCode":"调用地址",
-      "desc":"可填,请填写调用地址",
-      "required":false,
-      "hasDefaultValue":true,
-      "defaultValue":"http://order-service/orderApi/service",
-      "inputType":"input",
-      "limit":"maxLength",
-      "limitParam":"200",
-      "limitErrInfo":"调用地址不能超过200"
-    },
-    {
-      "code":"method",
-      "cnCode":"调用方式",
-      "desc":"必填,请填写调用方式",
-      "required":true,
-      "hasDefaultValue":false,
-      "inputType":"select",
-      "selectValue":"GET,POST",
-      "selectValueName":"http get,http post",
-      "limit":"maxLength",
-      "limitParam":"50",
-      "limitErrInfo":"调用方式不能超过50"
-    },
-    {
-      "code":"timeout",
-      "cnCode":"超时时间",
-      "desc":"必填,请填写超时时间",
-      "required":true,
-      "hasDefaultValue":true,
-      "defaultValue":"60",
-      "inputType":"input",
-      "limit":"num",
-      "limitParam":"",
-      "limitErrInfo":"超时时间必须为数字"
-    },
-    {
-      "code":"retryCount",
-      "cnCode":"重试次数",
-      "desc":"必填,请填写重试次数",
-      "required":true,
-      "hasDefaultValue":true,
-      "defaultValue":"3",
-      "inputType":"input",
-      "limit":"num",
-      "limitParam":"",
-      "limitErrInfo":"重试次数必须为数字"
-    },
-    {
-      "code":"provideAppId",
-      "cnCode":"提供服务",
-      "desc":"必填,请填写提供服务",
-      "required":true,
-      "hasDefaultValue":true,
-      "defaultValue":"8000418002",
-      "inputType":"none",
-      "limit":"num",
-      "limitParam":"",
-      "limitErrInfo":"重试次数必须为数字"
-    }
-
-  ]
-}

+ 2 - 3
java110-db/src/main/resources/mapper/mapping/MappingServiceDaoImplMapper.xml

@@ -7,9 +7,8 @@
     <!-- 保存映射信息 add by wuxw 2018-07-03 -->
        <insert id="saveMappingInfo" parameterType="Map">
            <![CDATA[
-            insert into c_mapping(
-            domain,name,remark,id,`key`,value) values (
-            #{domain},#{name},#{remark},#{id},#{key},#{value}
+            insert into c_mapping  values (
+            #{id},#{domain},#{name},#{key},#{value},#{remark},now(),'0'
             )
         ]]>