From 24e28829b02519e9a863d8350507c612605a0eab Mon Sep 17 00:00:00 2001 From: wanggeng <450292408@qq.com> Date: Mon, 16 Aug 2021 16:42:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=A8=A1=E6=9D=BF=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E9=97=AE=E9=A2=98=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E6=BA=90=E6=96=87=E4=BB=B6=E4=B8=8E=E5=8E=8B=E7=BC=A9?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=8C=E5=87=8F=E5=B0=91=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/api/impl/ApiInfoServiceImpl.java | 2 +- .../templates/ftl/api-template-source.ftl | 3250 ++++++++++++++++ .../resources/templates/ftl/api-template.ftl | 3252 +---------------- 3 files changed, 3253 insertions(+), 3251 deletions(-) create mode 100644 common/src/main/resources/templates/ftl/api-template-source.ftl diff --git a/common/src/main/java/ink/wgink/common/service/api/impl/ApiInfoServiceImpl.java b/common/src/main/java/ink/wgink/common/service/api/impl/ApiInfoServiceImpl.java index a0249b0e..5947da4a 100644 --- a/common/src/main/java/ink/wgink/common/service/api/impl/ApiInfoServiceImpl.java +++ b/common/src/main/java/ink/wgink/common/service/api/impl/ApiInfoServiceImpl.java @@ -183,7 +183,7 @@ public class ApiInfoServiceImpl extends DefaultBaseService implements IApiInfoSe apiMap.put("definitions", definitions); for (Tag tag : tags) { Map apiController = new HashMap<>(); - apiController.put("name", tag.getName().indexOf("\\-") > 0 ? tag.getName().split("\\-")[1] : tag.getName()); + apiController.put("name", tag.getName().indexOf("-") > 0 ? tag.getName().split("\\-")[1] : tag.getName()); apiController.put("description", tag.getDescription()); apiController.put("apis", listApiMap(tag.getName(), paths, definitions)); apiControllers.add(apiController); diff --git a/common/src/main/resources/templates/ftl/api-template-source.ftl b/common/src/main/resources/templates/ftl/api-template-source.ftl new file mode 100644 index 00000000..8f742c28 --- /dev/null +++ b/common/src/main/resources/templates/ftl/api-template-source.ftl @@ -0,0 +1,3250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${title} + + + + + + + + + + + + + + + + + + + + + + 接口设计文档 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 作者:${author} + + + + + + + + + + + + + + + + + + 时间:${date} + + + + + + + + + + + + + + + + + + 版本:${version} + + + + + + + + + + + + + + + + + + + + + +<#list apiGroups as apiGroup> + + + + + + + + + + + + + + + + + + + + + + + ${apiGroup.name} + + + <#list apiGroup.api.apiControllers as apiController> + + + + + + + + + + + + + + + + + + + + + + ${apiController.name} + + + <#list apiController.apis as api> + + + + + + + + + + + + + + + + + + + + + + ${api.summary} + + + + + + + + + + + + + + + + + + + + + + + + 功能描述 + + + + + + + + + + + + + + + + ${api.description} + + + + + + + + + + + + + + + + + + + + + + + + 接口说明 + + + + + + + + + + + + + + + + + + + + + + 请求方式:${api.method} + + + + + + + + + + + + + + + + + + + + + + 请求地址:${apiGroup.api.basePath}${api.apiUrl} + + + + + + + + + + + + + + + + + + + + + + 请求参数 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 名称 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 描述 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 参数类型 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 数据类型 + + + + + <#list api.parameters as parameter> + + + + + + + + + + + + + + + + + + + + + + ${parameter.name} + + + + + + + + + + + + + + + + + + + + + + + + ${parameter.description} + + + + + + + + + + + + + + + + + + + + + + + + ${parameter.in} + + + + + + + + + + + + + + + + + + + + + + + + ${parameter.type} + + + + + + + <#list api.parameterRefs as parameterRef> + + + + + + + + + + + + + + ${parameterRef.name}对象属性 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 属性名 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 描述 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 类型 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 构造对象 + + + + + <#list parameterRef.modelPropertiesList as modelProperties> + + + + + + + + + + + + + + + + + + + + + + + + + + ${modelProperties.name} + + + + + + + + + + + + + + + + + + + + + + + + + ${modelProperties.description} + + + + + + + + + + + + + + + + + + + + + + + + + ${modelProperties.type} + + + + + + + + + + + + + + + + + + + + + + + + + ${modelProperties.simpleRef} + + + + + + + + <#list api.parameterExamples as parameterExample> + + + + + + + + + + + + + + + + + + + + ${parameterExample.simpleRef} 示例 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${parameterExample.example} + + + + + + + + + + + + + + + + + + + + + + + + + + 响应 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 响应状态码 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 说明 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 返回值 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 返回类型` + + + + + <#list api.responses as response> + + + + + + + + + + + + + + + + + + + + + + + + + ${response.code} + + + + + + + + + + + + + + + + + + + + + + + + ${response.description} + + + + + + + + + + + + + + + + + + + + + + + + ${response.simpleRef} + + + + + + + + + + + + + + + + + + + + + + + + ${response.type} + + + + + + + <#list api.responseRefs as responseRef> + + + + + + + + + + + + + + ${responseRef.name}对象属性 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 名称 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 描述 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 参数类型 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 数据类型 + + + + + <#if (responseRef.modelPropertiesList)??> + <#list responseRef.modelPropertiesList as modelProperties> + + + + + + + + + + + + + + + + + + + + + + + + + ${modelProperties.name} + + + + + + + + + + + + + + + + + + + + + + + + ${modelProperties.description} + + + + + + + + + + + + + + + + + + + + + + + + ${modelProperties.type} + + + + + + + + + + + + + + + + + + + + + + + + ${modelProperties.simpleRef} + + + + + + + + + <#list api.responseExamples as responseExample> + + + + + + + + + + + + + + + + + + + + ${responseExample.simpleRef}示例 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${responseExample.example} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 王 耿 + + + 王 耿 + 2 + 2021-08-13T23:46:00Z + 2021-08-13T23:46:00Z + + + + + + + + 1 + 2 + 60 + 342 + Microsoft Office Word + 0 + 2 + 1 + false + + false + 401 + false + false + 16.0000 + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/resources/templates/ftl/api-template.ftl b/common/src/main/resources/templates/ftl/api-template.ftl index 8f742c28..693a9123 100644 --- a/common/src/main/resources/templates/ftl/api-template.ftl +++ b/common/src/main/resources/templates/ftl/api-template.ftl @@ -1,3250 +1,2 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${title} - - - - - - - - - - - - - - - - - - - - - - 接口设计文档 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 作者:${author} - - - - - - - - - - - - - - - - - - 时间:${date} - - - - - - - - - - - - - - - - - - 版本:${version} - - - - - - - - - - - - - - - - - - - - - -<#list apiGroups as apiGroup> - - - - - - - - - - - - - - - - - - - - - - - ${apiGroup.name} - - - <#list apiGroup.api.apiControllers as apiController> - - - - - - - - - - - - - - - - - - - - - - ${apiController.name} - - - <#list apiController.apis as api> - - - - - - - - - - - - - - - - - - - - - - ${api.summary} - - - - - - - - - - - - - - - - - - - - - - - - 功能描述 - - - - - - - - - - - - - - - - ${api.description} - - - - - - - - - - - - - - - - - - - - - - - - 接口说明 - - - - - - - - - - - - - - - - - - - - - - 请求方式:${api.method} - - - - - - - - - - - - - - - - - - - - - - 请求地址:${apiGroup.api.basePath}${api.apiUrl} - - - - - - - - - - - - - - - - - - - - - - 请求参数 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 名称 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 描述 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 参数类型 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 数据类型 - - - - - <#list api.parameters as parameter> - - - - - - - - - - - - - - - - - - - - - - ${parameter.name} - - - - - - - - - - - - - - - - - - - - - - - - ${parameter.description} - - - - - - - - - - - - - - - - - - - - - - - - ${parameter.in} - - - - - - - - - - - - - - - - - - - - - - - - ${parameter.type} - - - - - - - <#list api.parameterRefs as parameterRef> - - - - - - - - - - - - - - ${parameterRef.name}对象属性 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 属性名 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 描述 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 类型 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 构造对象 - - - - - <#list parameterRef.modelPropertiesList as modelProperties> - - - - - - - - - - - - - - - - - - - - - - - - - - ${modelProperties.name} - - - - - - - - - - - - - - - - - - - - - - - - - ${modelProperties.description} - - - - - - - - - - - - - - - - - - - - - - - - - ${modelProperties.type} - - - - - - - - - - - - - - - - - - - - - - - - - ${modelProperties.simpleRef} - - - - - - - - <#list api.parameterExamples as parameterExample> - - - - - - - - - - - - - - - - - - - - ${parameterExample.simpleRef} 示例 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${parameterExample.example} - - - - - - - - - - - - - - - - - - - - - - - - - - 响应 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 响应状态码 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 说明 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 返回值 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 返回类型` - - - - - <#list api.responses as response> - - - - - - - - - - - - - - - - - - - - - - - - - ${response.code} - - - - - - - - - - - - - - - - - - - - - - - - ${response.description} - - - - - - - - - - - - - - - - - - - - - - - - ${response.simpleRef} - - - - - - - - - - - - - - - - - - - - - - - - ${response.type} - - - - - - - <#list api.responseRefs as responseRef> - - - - - - - - - - - - - - ${responseRef.name}对象属性 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 名称 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 描述 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 参数类型 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 数据类型 - - - - - <#if (responseRef.modelPropertiesList)??> - <#list responseRef.modelPropertiesList as modelProperties> - - - - - - - - - - - - - - - - - - - - - - - - - ${modelProperties.name} - - - - - - - - - - - - - - - - - - - - - - - - ${modelProperties.description} - - - - - - - - - - - - - - - - - - - - - - - - ${modelProperties.type} - - - - - - - - - - - - - - - - - - - - - - - - ${modelProperties.simpleRef} - - - - - - - - - <#list api.responseExamples as responseExample> - - - - - - - - - - - - - - - - - - - - ${responseExample.simpleRef}示例 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${responseExample.example} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 王 耿 - - - 王 耿 - 2 - 2021-08-13T23:46:00Z - 2021-08-13T23:46:00Z - - - - - - - - 1 - 2 - 60 - 342 - Microsoft Office Word - 0 - 2 - 1 - false - - false - 401 - false - false - 16.0000 - - - - - - - - - - - \ No newline at end of file +${title}接口设计文档作者:${author}时间:${date}版本:${version}<#list apiGroups as apiGroup>${apiGroup.name}<#list apiGroup.api.apiControllers as apiController>${apiController.name}<#list apiController.apis as api>${api.summary}功能描述${api.description}接口说明请求方式:${api.method}请求地址:${apiGroup.api.basePath}${api.apiUrl}请求参数名称描述参数类型数据类型<#list api.parameters as parameter>${parameter.name}${parameter.description}${parameter.in}${parameter.type}<#list api.parameterRefs as parameterRef>${parameterRef.name}对象属性属性名描述类型构造对象<#list parameterRef.modelPropertiesList as modelProperties>${modelProperties.name}${modelProperties.description}${modelProperties.type}${modelProperties.simpleRef}<#list api.parameterExamples as parameterExample>${parameterExample.simpleRef} 示例${parameterExample.example}响应响应状态码说明返回值返回类型` + <#list api.responses as response>${response.code}${response.description}${response.simpleRef}${response.type}<#list api.responseRefs as responseRef>${responseRef.name}对象属性名称描述参数类型数据类型<#if (responseRef.modelPropertiesList)??><#list responseRef.modelPropertiesList as modelProperties>${modelProperties.name}${modelProperties.description}${modelProperties.type}${modelProperties.simpleRef}<#list api.responseExamples as responseExample>${responseExample.simpleRef}示例${responseExample.example}王 耿王 耿22021-08-13T23:46:00Z2021-08-13T23:46:00Z1260342Microsoft Office Word021falsefalse401falsefalse16.0000 \ No newline at end of file