Commit bf933e77 authored by 赵啸非's avatar 赵啸非

添加apipost生成接口文档逻辑

parent 93d93ef0
...@@ -202,7 +202,6 @@ ...@@ -202,7 +202,6 @@
import Qs from "qs"; import Qs from "qs";
import { import {
type, type,
download,
downloadWithCustName, downloadWithCustName,
getUserListByQuery, getUserListByQuery,
} from "@/assets/utils"; } from "@/assets/utils";
...@@ -358,6 +357,7 @@ export default { ...@@ -358,6 +357,7 @@ export default {
path: path, path: path,
query: Object.assign({}, query, data), query: Object.assign({}, query, data),
}); });
}, },
// 解析url字符串,去除query字段 // 解析url字符串,去除query字段
encode(data, formTemp) { encode(data, formTemp) {
......
...@@ -257,7 +257,6 @@ export default { ...@@ -257,7 +257,6 @@ export default {
mixins: [table], mixins: [table],
created() { created() {
const appId = this.$route.query["query.appId"]; const appId = this.$route.query["query.appId"];
console.log("appId", appId);
this.appId = appId; this.appId = appId;
this.upload.url = this.upload.url+ this.appId this.upload.url = this.upload.url+ this.appId
//this.query={ appId: appId } //this.query={ appId: appId }
......
...@@ -29,7 +29,13 @@ public class GentableEntityExt extends BaseEntityLong { ...@@ -29,7 +29,13 @@ public class GentableEntityExt extends BaseEntityLong {
private String requestMapping; private String requestMapping;
private String code; private String code;
private String name;
private String desc;
/**
* 项目应用访问path
*/
private String path; private String path;
private List<Long> idList; private List<Long> idList;
...@@ -42,8 +48,8 @@ public class GentableEntityExt extends BaseEntityLong { ...@@ -42,8 +48,8 @@ public class GentableEntityExt extends BaseEntityLong {
public static boolean isSuperColumn(String javaField) { public static boolean isSuperColumn(String javaField) {
return StringUtils.equalsAnyIgnoreCase(javaField, return StringUtils.equalsAnyIgnoreCase(javaField,
// BaseEntity // BaseEntity
"id","createUser", "createTime", "updateUser", "id", "createUser", "createTime", "updateUser",
"updateTime","createUserId","updateUserId" "updateTime", "createUserId", "updateUserId"
// TreeEntity // TreeEntity
//"parentName", "parentId", "orderNum", "ancestors" //"parentName", "parentId", "orderNum", "ancestors"
...@@ -51,5 +57,4 @@ public class GentableEntityExt extends BaseEntityLong { ...@@ -51,5 +57,4 @@ public class GentableEntityExt extends BaseEntityLong {
} }
} }
\ No newline at end of file
...@@ -31,6 +31,7 @@ import com.mortals.xhx.module.app.service.AppService; ...@@ -31,6 +31,7 @@ import com.mortals.xhx.module.app.service.AppService;
import freemarker.template.Template; import freemarker.template.Template;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apiguardian.api.API;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -42,6 +43,7 @@ import java.io.File; ...@@ -42,6 +43,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.*; import java.util.*;
import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
...@@ -170,7 +172,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -170,7 +172,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
} }
if (gentableEntity.getIsShowControl() != null) { if (gentableEntity.getIsShowControl() != null) {
if (gentableEntity.getIsShowControl() == 2) { if (gentableEntity.getIsShowControl() == 2) {
if (temp.contains("webForm.java.ftl")||temp.contains("web.java.ftl")) { if (temp.contains("webForm.java.ftl") || temp.contains("web.java.ftl")) {
continue; continue;
} }
// if (temp.contains("entity.java.ftl")||temp.contains("entityQuery.java.ftl")) { // if (temp.contains("entity.java.ftl")||temp.contains("entityQuery.java.ftl")) {
...@@ -182,7 +184,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -182,7 +184,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
} }
} }
} else { } else {
if (temp.contains("webForm.java.ftl")||temp.contains("web.java.ftl")) { if (temp.contains("webForm.java.ftl") || temp.contains("web.java.ftl")) {
continue; continue;
} }
} }
...@@ -213,7 +215,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -213,7 +215,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
} }
if (temp.equals("menu.sql.ftl") || temp.equals("db.sql.ftl")|| temp.equals("dm_db.sql.ftl") || temp.equals("api.md.ftl")) { if (temp.equals("menu.sql.ftl") || temp.equals("db.sql.ftl") || temp.equals("dm_db.sql.ftl") || temp.equals("api.md.ftl")|| temp.equals("apipost.md.ftl")) {
try { try {
List<GentableEntity> tableList = new ArrayList<>(); List<GentableEntity> tableList = new ArrayList<>();
tableList.add(gentableEntity); tableList.add(gentableEntity);
...@@ -273,6 +275,8 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -273,6 +275,8 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
zipTemplate("dm_db.sql.ftl", "db/dm_db.sql", data, zip); zipTemplate("dm_db.sql.ftl", "db/dm_db.sql", data, zip);
FreeMarkerUtils.initFreeMarker(genFreePath("api.md.ftl")); FreeMarkerUtils.initFreeMarker(genFreePath("api.md.ftl"));
zipTemplate("api.md.ftl", "doc/api.md", data, zip); zipTemplate("api.md.ftl", "doc/api.md", data, zip);
FreeMarkerUtils.initFreeMarker(genFreePath("apipost.md.ftl"));
zipTemplate("apipost.ftl", "doc/apipost.json", data, zip);
IOUtils.closeQuietly(zip); IOUtils.closeQuietly(zip);
return outputStream.toByteArray(); return outputStream.toByteArray();
...@@ -288,14 +292,22 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -288,14 +292,22 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
GentableEntity gentableEntity = generatorCode(tableId, genTypes, zip); GentableEntity gentableEntity = generatorCode(tableId, genTypes, zip);
tableList.add(gentableEntity); tableList.add(gentableEntity);
} }
AppEntity appEntity = new AppEntity();
appEntity.setName(tableList.get(0).getName());
appEntity.setCode(tableList.get(0).getCode());
appEntity.setPath(tableList.get(0).getPath());
Map data = new HashMap(); Map data = new HashMap();
data.put("tableList", tableList); data.put("tableList", tableList);
data.put("appInfo", appEntity);
FreeMarkerUtils.initFreeMarker(genFreePath("menu.sql.ftl")); FreeMarkerUtils.initFreeMarker(genFreePath("menu.sql.ftl"));
zipTemplate("menu.sql.ftl", "db/menu.sql", data, zip); zipTemplate("menu.sql.ftl", "db/menu.sql", data, zip);
zipTemplate("db.sql.ftl", "db/db.sql", data, zip); zipTemplate("db.sql.ftl", "db/db.sql", data, zip);
zipTemplate("dm_db.sql.ftl", "db/dm_db.sql", data, zip); zipTemplate("dm_db.sql.ftl", "db/dm_db.sql", data, zip);
FreeMarkerUtils.initFreeMarker(genFreePath("api.md.ftl")); FreeMarkerUtils.initFreeMarker(genFreePath("api.md.ftl"));
zipTemplate("api.md.ftl", "doc/api.md", data, zip); zipTemplate("api.md.ftl", "doc/api.md", data, zip);
zipTemplate("apipost.md.ftl", "doc/apipost.json", data, zip);
IOUtils.closeQuietly(zip); IOUtils.closeQuietly(zip);
return outputStream.toByteArray(); return outputStream.toByteArray();
} }
...@@ -522,7 +534,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -522,7 +534,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
} }
if (gentableEntity.getIsShowControl() != null) { if (gentableEntity.getIsShowControl() != null) {
if (gentableEntity.getIsShowControl() == 2) { if (gentableEntity.getIsShowControl() == 2) {
if (temp.contains("webForm.java.ftl")||temp.contains("web.java.ftl")) { if (temp.contains("webForm.java.ftl") || temp.contains("web.java.ftl")) {
continue; continue;
} }
} else if (gentableEntity.getIsShowControl() == 0) { } else if (gentableEntity.getIsShowControl() == 0) {
...@@ -531,7 +543,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -531,7 +543,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
} }
} }
} else { } else {
if (temp.contains("webForm.java.ftl")||temp.contains("web.java.ftl")) { if (temp.contains("webForm.java.ftl") || temp.contains("web.java.ftl")) {
continue; continue;
} }
} }
...@@ -573,6 +585,9 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -573,6 +585,9 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
if (temp.equals("api.md.ftl")) { if (temp.equals("api.md.ftl")) {
continue; continue;
} }
if (temp.equals("apipost.md.ftl")) {
continue;
}
try { try {
FreeMarkerUtils.initFreeMarker(genFreePath(temp)); FreeMarkerUtils.initFreeMarker(genFreePath(temp));
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
...@@ -594,10 +609,14 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge ...@@ -594,10 +609,14 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
private void buildAppInfo(GentableEntity gentableEntity) { private void buildAppInfo(GentableEntity gentableEntity) {
AppEntity appEntity = appService.get(gentableEntity.getAppId()); AppEntity appEntity = appService.get(gentableEntity.getAppId());
gentableEntity.setCode(appEntity.getCode()); gentableEntity.setCode(appEntity.getCode() == null ? "" : appEntity.getCode());
gentableEntity.setPath(appEntity.getPath()); gentableEntity.setPath(appEntity.getPath() == null ? "" : appEntity.getPath());
gentableEntity.setName(appEntity.getName() == null ? "" : appEntity.getName());
gentableEntity.setDesc(appEntity.getRemark() == null ? "" : appEntity.getRemark());
} }
/** /**
* 生成文档 * 生成文档
*/ */
......
...@@ -171,7 +171,6 @@ public class GentableController extends BaseCRUDJsonMappingController<GentableSe ...@@ -171,7 +171,6 @@ public class GentableController extends BaseCRUDJsonMappingController<GentableSe
Map<String, Object> model = new HashMap<>(); Map<String, Object> model = new HashMap<>();
String busiDesc = "生成单表代码"; String busiDesc = "生成单表代码";
try { try {
byte[] bytes = this.service.downloadCode(tableId, genTypes); byte[] bytes = this.service.downloadCode(tableId, genTypes);
genCode(response, bytes); genCode(response, bytes);
recordSysLog(request, busiDesc + " 【成功】"); recordSysLog(request, busiDesc + " 【成功】");
......
package com.mortals.xhx.common.utils;
public class ApiPostBuild {
}
...@@ -8,6 +8,7 @@ import com.mortals.xhx.base.system.gentable.model.GentableColumnEntity; ...@@ -8,6 +8,7 @@ import com.mortals.xhx.base.system.gentable.model.GentableColumnEntity;
import com.mortals.xhx.base.system.gentable.model.GentableEntity; import com.mortals.xhx.base.system.gentable.model.GentableEntity;
import com.mortals.xhx.base.system.gentable.model.ProjectInfoEntity; import com.mortals.xhx.base.system.gentable.model.ProjectInfoEntity;
import com.mortals.xhx.common.key.GenConstants; import com.mortals.xhx.common.key.GenConstants;
import com.mortals.xhx.module.app.model.AppEntity;
import freemarker.template.Configuration; import freemarker.template.Configuration;
import freemarker.template.Template; import freemarker.template.Template;
import freemarker.template.TemplateException; import freemarker.template.TemplateException;
...@@ -103,6 +104,7 @@ public class FreeMarkerUtils { ...@@ -103,6 +104,7 @@ public class FreeMarkerUtils {
templates.add("dm_db.sql.ftl"); templates.add("dm_db.sql.ftl");
templates.add("menu.sql.ftl"); templates.add("menu.sql.ftl");
templates.add("api.md.ftl"); templates.add("api.md.ftl");
templates.add("apipost.md.ftl");
if (GenConstants.TPL_CRUD.equals(tplCategory)) { if (GenConstants.TPL_CRUD.equals(tplCategory)) {
templates.add("service.java.ftl"); templates.add("service.java.ftl");
...@@ -187,10 +189,15 @@ public class FreeMarkerUtils { ...@@ -187,10 +189,15 @@ public class FreeMarkerUtils {
data.put("importList", getImportList(genTable)); data.put("importList", getImportList(genTable));
data.put("columns", genTable.getColumns()); data.put("columns", genTable.getColumns());
data.put("table", genTable); data.put("table", genTable);
data.put("code", genTable.getCode()==null?"":genTable.getCode()); data.put("code", genTable.getCode() == null ? "" : genTable.getCode());
data.put("path", genTable.getPath()==null?"":genTable.getPath()); data.put("path", genTable.getPath() == null ? "" : genTable.getPath());
//com.mortals.xhx.feign.area data.put("packageFeignName", "com.mortals.xhx.feign." + businessName);
data.put("packageFeignName", "com.mortals.xhx.feign."+businessName); AppEntity appEntity = new AppEntity();
appEntity.setName(genTable.getName());
appEntity.setPath(genTable.getPath());
appEntity.setCode(genTable.getCode());
data.put("appInfo", appEntity);
String RequestMapping = Arrays.stream(getBusinessNameExt(genTable.getTableName()).split("\\.")).collect(Collectors.joining("/")); String RequestMapping = Arrays.stream(getBusinessNameExt(genTable.getTableName()).split("\\.")).collect(Collectors.joining("/"));
data.put("RequestMapping", RequestMapping); data.put("RequestMapping", RequestMapping);
...@@ -244,13 +251,13 @@ public class FreeMarkerUtils { ...@@ -244,13 +251,13 @@ public class FreeMarkerUtils {
String treeParentCode = getTreeParentCode(paramsObj); String treeParentCode = getTreeParentCode(paramsObj);
//获取树编码父节点类型 todo //获取树编码父节点类型 todo
String treeParentCodeType ="String"; String treeParentCodeType = "String";
List<GentableColumnEntity> columns = genTable.getColumns(); List<GentableColumnEntity> columns = genTable.getColumns();
for (GentableColumnEntity column : columns) { for (GentableColumnEntity column : columns) {
if(treeParentCode.equals(column.getColumnName())){ if (treeParentCode.equals(column.getColumnName())) {
treeParentCodeType=column.getJavaType(); treeParentCodeType = column.getJavaType();
break; break;
} }
} }
...@@ -463,19 +470,15 @@ public class FreeMarkerUtils { ...@@ -463,19 +470,15 @@ public class FreeMarkerUtils {
String businessNameExt = getBusinessNameExt(genTable.getTableName()); String businessNameExt = getBusinessNameExt(genTable.getTableName());
businessNameExt = StringUtils.replace(businessNameExt, ".", "/"); businessNameExt = StringUtils.replace(businessNameExt, ".", "/");
fileName = StringUtils.format("{}/views/{}/list.vue", vuePath, businessNameExt); fileName = StringUtils.format("{}/views/{}/list.vue", vuePath, businessNameExt);
} } else if (template.contains("webVueShow.vue.ftl")) {
else if (template.contains("webVueShow.vue.ftl")) {
String businessNameExt = getBusinessNameExt(genTable.getTableName()); String businessNameExt = getBusinessNameExt(genTable.getTableName());
businessNameExt = StringUtils.replace(businessNameExt, ".", "/"); businessNameExt = StringUtils.replace(businessNameExt, ".", "/");
fileName = StringUtils.format("{}/views/{}/show.vue", vuePath, businessNameExt); fileName = StringUtils.format("{}/views/{}/show.vue", vuePath, businessNameExt);
} } else if (template.contains("webVueView.vue.ftl")) {
else if (template.contains("webVueView.vue.ftl")) {
String businessNameExt = getBusinessNameExt(genTable.getTableName()); String businessNameExt = getBusinessNameExt(genTable.getTableName());
businessNameExt = StringUtils.replace(businessNameExt, ".", "/"); businessNameExt = StringUtils.replace(businessNameExt, ".", "/");
fileName = StringUtils.format("{}/views/{}/view.vue", vuePath, businessNameExt); fileName = StringUtils.format("{}/views/{}/view.vue", vuePath, businessNameExt);
} } else if (template.contains("webVueTreeList.vue.ftl")) {
else if (template.contains("webVueTreeList.vue.ftl")) {
String businessNameExt = getBusinessNameExt(genTable.getTableName()); String businessNameExt = getBusinessNameExt(genTable.getTableName());
businessNameExt = StringUtils.replace(businessNameExt, ".", "/"); businessNameExt = StringUtils.replace(businessNameExt, ".", "/");
fileName = StringUtils.format("{}/views/{}/list.vue", vuePath, businessNameExt); fileName = StringUtils.format("{}/views/{}/list.vue", vuePath, businessNameExt);
...@@ -491,8 +494,7 @@ public class FreeMarkerUtils { ...@@ -491,8 +494,7 @@ public class FreeMarkerUtils {
String businessNameExt = getBusinessNameExt(genTable.getTableName()); String businessNameExt = getBusinessNameExt(genTable.getTableName());
businessNameExt = StringUtils.replace(businessNameExt, ".", "/"); businessNameExt = StringUtils.replace(businessNameExt, ".", "/");
fileName = StringUtils.format("{}/views/{}/drawershow.vue", vuePath, businessNameExt); fileName = StringUtils.format("{}/views/{}/drawershow.vue", vuePath, businessNameExt);
} } else if (template.contains("db.doc.ftl")) {
else if (template.contains("db.doc.ftl")) {
fileName = StringUtils.format("doc/alldoc.docx"); fileName = StringUtils.format("doc/alldoc.docx");
} else if (template.contains("api.doc.ftl")) { } else if (template.contains("api.doc.ftl")) {
fileName = StringUtils.format("doc/api.md"); fileName = StringUtils.format("doc/api.md");
...@@ -545,7 +547,6 @@ public class FreeMarkerUtils { ...@@ -545,7 +547,6 @@ public class FreeMarkerUtils {
* @param destFile 目标文件地址 * @param destFile 目标文件地址
*/ */
public static String printFile(String templateName, Map dataModel, String destFile) { public static String printFile(String templateName, Map dataModel, String destFile) {
System.out.println(destFile);
Template template = getTemplate(templateName); Template template = getTemplate(templateName);
try { try {
template.process(dataModel, new FileWriter(new File(destFile))); template.process(dataModel, new FileWriter(new File(destFile)));
......
...@@ -263,10 +263,7 @@ public class GenUtils { ...@@ -263,10 +263,7 @@ public class GenUtils {
if (tableName.indexOf("_") != -1) { if (tableName.indexOf("_") != -1) {
businessName = StringUtils.substring(tableName, 0, tableName.indexOf("_")); businessName = StringUtils.substring(tableName, 0, tableName.indexOf("_"));
} }
//业务名称 保留两位 //业务名称 保留两位
return businessName; return businessName;
} }
...@@ -369,10 +366,7 @@ public class GenUtils { ...@@ -369,10 +366,7 @@ public class GenUtils {
public static void main(String[] args) { public static void main(String[] args) {
String name = "aaa"; String name = "aaa";
System.out.println(Arrays.stream(name.split("_")).collect(Collectors.joining("."))); System.out.println(Arrays.stream(name.split("_")).collect(Collectors.joining(".")));
System.out.println(Arrays.stream("data".split(".")).collect(Collectors.joining("/"))); System.out.println(Arrays.stream("data".split(".")).collect(Collectors.joining("/")));
} }
} }
...@@ -15,6 +15,7 @@ object|对象类型|{"name":"zhang3"} ...@@ -15,6 +15,7 @@ object|对象类型|{"name":"zhang3"}
arrays|数组类型|[{"name":"zhang3"},{"name":"zhang2"}] arrays|数组类型|[{"name":"zhang3"},{"name":"zhang2"}]
<#if (tableList?size > 1) >
## 系统服务 ## 系统服务
### 登录 ### 登录
...@@ -212,12 +213,14 @@ Content-Type: multipart/form-data ...@@ -212,12 +213,14 @@ Content-Type: multipart/form-data
``` ```
</#if>
<#list tableList as table> <#list tableList as table>
## ${table.functionName} ## ${table.functionName}
### 查询${table.functionName}列表 ### 查询${table.functionName}列表
**请求URL:** ${table.requestMapping}/list **请求URL:** ${table.path}/${table.requestMapping}/list
**请求方式:** POST **请求方式:** POST
...@@ -243,7 +246,7 @@ ${column.javaField}|${column.javaType}|否|${column.columnComment} ...@@ -243,7 +246,7 @@ ${column.javaField}|${column.javaType}|否|${column.columnComment}
**请求样例:** **请求样例:**
``` ```
{ {
<#list table.columns as column> <#list table.columns as column>
<#if column.isQuery == 1> <#if column.isQuery == 1>
<#if column.javaType=="String" ||column.javaType=="Date"> <#if column.javaType=="String" ||column.javaType=="Date">
...@@ -256,7 +259,7 @@ ${column.javaField}|${column.javaType}|否|${column.columnComment} ...@@ -256,7 +259,7 @@ ${column.javaField}|${column.javaType}|否|${column.columnComment}
</#list> </#list>
"page":1, "page":1,
"size":10 "size":10
} }
``` ```
**响应参数:** **响应参数:**
...@@ -292,7 +295,7 @@ dict|object|字典对象 ...@@ -292,7 +295,7 @@ dict|object|字典对象
### 查看${table.functionName} ### 查看${table.functionName}
**请求URL:** ${table.requestMapping}/info **请求URL:** ${table.path}/${table.requestMapping}/info
**请求方式:** GET **请求方式:** GET
...@@ -308,7 +311,7 @@ ${table.pkColumn.javaField}|${table.pkColumn.javaType}|是|ID ...@@ -308,7 +311,7 @@ ${table.pkColumn.javaField}|${table.pkColumn.javaType}|是|ID
**请求样例:** **请求样例:**
``` ```
http://localhost/${table.requestMapping}/info?id=549 http://localhost/${table.path}/${table.requestMapping}/info?id=549
``` ```
**响应参数:** **响应参数:**
...@@ -346,7 +349,7 @@ dict|object|字典对象 ...@@ -346,7 +349,7 @@ dict|object|字典对象
### 保存更新${table.functionName} ### 保存更新${table.functionName}
**请求URL:** ${table.requestMapping}/save **请求URL:** ${table.path}/${table.requestMapping}/save
**请求方式:** POST **请求方式:** POST
...@@ -410,7 +413,7 @@ data|object|数据对象 ...@@ -410,7 +413,7 @@ data|object|数据对象
### 删除${table.functionName} ### 删除${table.functionName}
**请求URL:** ${table.requestMapping}/delete **请求URL:** ${table.path}/${table.requestMapping}/delete
**请求方式:** GET **请求方式:** GET
...@@ -426,7 +429,7 @@ ${table.pkColumn.javaField}|String|是|数组 ...@@ -426,7 +429,7 @@ ${table.pkColumn.javaField}|String|是|数组
**请求样例:** **请求样例:**
``` ```
http://localhost:8080/${table.requestMapping}/delete?id=1&id=2' http://localhost:8080/${table.path}/${table.requestMapping}/delete?id=1&id=2'
``` ```
**响应参数:** **响应参数:**
...@@ -447,7 +450,7 @@ msg|String|消息|- ...@@ -447,7 +450,7 @@ msg|String|消息|-
### 导入${table.functionName}模板下载 ### 导入${table.functionName}模板下载
**请求URL:** ${table.requestMapping}/downloadTemplate **请求URL:** ${table.path}/${table.requestMapping}/downloadTemplate
**请求方式:** POST **请求方式:** POST
...@@ -457,7 +460,7 @@ msg|String|消息|- ...@@ -457,7 +460,7 @@ msg|String|消息|-
**请求样例:** **请求样例:**
``` ```
http://localhost/${table.requestMapping}/downloadTemplate http://localhost/${table.path}/${table.requestMapping}/downloadTemplate
``` ```
**Response-example:** **Response-example:**
...@@ -468,7 +471,7 @@ msg|String|消息|- ...@@ -468,7 +471,7 @@ msg|String|消息|-
### 导入${table.functionName} ### 导入${table.functionName}
**请求URL:** ${table.requestMapping}/importData **请求URL:** ${table.path}/${table.requestMapping}/importData
**请求方式:** POST **请求方式:** POST
...@@ -484,7 +487,7 @@ file|file|是|文件流 ...@@ -484,7 +487,7 @@ file|file|是|文件流
**请求样例:** **请求样例:**
``` ```
http://localhost/${table.requestMapping}/importData --data 'updateSupport=true' http://localhost/${table.path}/${table.requestMapping}/importData --data 'updateSupport=true'
``` ```
...@@ -496,7 +499,7 @@ file|file|是|文件流 ...@@ -496,7 +499,7 @@ file|file|是|文件流
### 导出${table.functionName} ### 导出${table.functionName}
**请求URL:** ${table.requestMapping}/exportExcel **请求URL:** ${table.path}/${table.requestMapping}/exportExcel
**请求方式:** POST **请求方式:** POST
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -58,6 +58,17 @@ public class ${ClassName}Entity extends ${ClassName}Vo { ...@@ -58,6 +58,17 @@ public class ${ClassName}Entity extends ${ClassName}Vo {
/** /**
* ${column.columnComment} * ${column.columnComment}
*/ */
<#if column.isExport==1>
<#assign comment=column.subComment(column.columnComment) />
<#assign parentheseIndex =column.columnComment?index_of("(")>
<#if parentheseIndex != -1>
@Excel(name = "${comment}", readConverterExp = "${column.readConverterExp()}")
<#elseif column.javaType == "Date">
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
<#else>
@Excel(name = "${comment}")
</#if>
</#if>
<#if column.isSerialize==1> <#if column.isSerialize==1>
@JSONField(serialize = false) @JSONField(serialize = false)
</#if> </#if>
......
...@@ -15,7 +15,6 @@ client.global.set("authToken", JSON.parse(response.body).data.token); ...@@ -15,7 +15,6 @@ client.global.set("authToken", JSON.parse(response.body).data.token);
###${functionName}列表 ###${functionName}列表
POST {{baseUrl}}/${RequestMapping}/list POST {{baseUrl}}/${RequestMapping}/list
Authorization: {{authToken}}
Content-Type: application/json Content-Type: application/json
{ {
...@@ -58,12 +57,10 @@ client.global.set("${ClassName}_id", JSON.parse(response.body).data.id); ...@@ -58,12 +57,10 @@ client.global.set("${ClassName}_id", JSON.parse(response.body).data.id);
###${functionName}查看 ###${functionName}查看
GET {{baseUrl}}/${RequestMapping}/info?id={{${ClassName}_id}} GET {{baseUrl}}/${RequestMapping}/info?id={{${ClassName}_id}}
Authorization: {{authToken}}
Accept: application/json Accept: application/json
###${functionName}编辑 ###${functionName}编辑
GET {{baseUrl}}/${RequestMapping}/edit?id={{${ClassName}_id}} GET {{baseUrl}}/${RequestMapping}/edit?id={{${ClassName}_id}}
Authorization: {{authToken}}
Accept: application/json Accept: application/json
......
...@@ -41,30 +41,6 @@ import java.util.Date; ...@@ -41,30 +41,6 @@ import java.util.Date;
@Data @Data
public class ${ClassName}Vo extends ${Entity} { public class ${ClassName}Vo extends ${Entity} {
<#list columns as column>
<#if !column.isSuperColumn(column.javaField) && column.isExport==1>
/**
* ${column.columnComment}
*/
<#if column.isExport==1>
<#assign comment=column.subComment(column.columnComment) />
<#assign parentheseIndex =column.columnComment?index_of("(")>
<#if parentheseIndex != -1>
@Excel(name = "${comment}", readConverterExp = "${column.readConverterExp()}")
<#elseif column.javaType == "Date">
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
<#else>
@Excel(name = "${comment}")
</#if>
</#if>
<#if column.isSerialize==1>
@JSONField(serialize = false)
</#if>
private ${column.javaType} ${column.javaField};
</#if>
</#list>
<#if table.tplCategory=="tree" > <#if table.tplCategory=="tree" >
/** ${functionName} */ /** ${functionName} */
private List<${ClassName}Entity> children = new ArrayList<>(); private List<${ClassName}Entity> children = new ArrayList<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment