合并api文档编辑页面,体验优化
This commit is contained in:
@@ -25,6 +25,11 @@ public class ApiGlobalParam implements Serializable {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* api_doc主键ID
|
||||
*/
|
||||
private Long docId;
|
||||
|
||||
/**
|
||||
* 参数类型 1=form 2=header 3=cookie
|
||||
*/
|
||||
@@ -143,4 +148,12 @@ public class ApiGlobalParam implements Serializable {
|
||||
", yn=" + yn +
|
||||
"}";
|
||||
}
|
||||
|
||||
public Long getDocId() {
|
||||
return docId;
|
||||
}
|
||||
|
||||
public void setDocId(Long docId) {
|
||||
this.docId = docId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.zyplayer.doc.data.repository.manage.vo;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* api文档地址Vo
|
||||
@@ -9,7 +10,7 @@ import java.util.Date;
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-25
|
||||
*/
|
||||
public class ApiDocVo implements Serializable {
|
||||
public class ApiDocVo extends ApiDoc implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -18,206 +19,6 @@ public class ApiDocVo implements Serializable {
|
||||
*/
|
||||
private Integer authType;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 文档类型 1=swagger url 2=swagger json 3=openapi url 4=openapi json 5=自建API分组
|
||||
*/
|
||||
private Integer docType;
|
||||
|
||||
/**
|
||||
* 文档URL地址
|
||||
*/
|
||||
private String docUrl;
|
||||
|
||||
/**
|
||||
* 文档json内容
|
||||
*/
|
||||
private String jsonContent;
|
||||
|
||||
/**
|
||||
* 重写的域名
|
||||
*/
|
||||
private String rewriteDomain;
|
||||
|
||||
/**
|
||||
* 是否开放访问 0=否 1=是
|
||||
*/
|
||||
private Integer openVisit;
|
||||
|
||||
/**
|
||||
* 状态 1=启用 2=禁用
|
||||
*/
|
||||
private Integer docStatus;
|
||||
|
||||
/**
|
||||
* 开放文档UUID
|
||||
*/
|
||||
private String shareUuid;
|
||||
|
||||
/**
|
||||
* 开放文档使用说明
|
||||
*/
|
||||
private String shareInstruction;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 是否有效 0=无效 1=有效
|
||||
*/
|
||||
private Integer yn;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getDocType() {
|
||||
return docType;
|
||||
}
|
||||
|
||||
public void setDocType(Integer docType) {
|
||||
this.docType = docType;
|
||||
}
|
||||
|
||||
public String getDocUrl() {
|
||||
return docUrl;
|
||||
}
|
||||
|
||||
public void setDocUrl(String docUrl) {
|
||||
this.docUrl = docUrl;
|
||||
}
|
||||
|
||||
public String getJsonContent() {
|
||||
return jsonContent;
|
||||
}
|
||||
|
||||
public void setJsonContent(String jsonContent) {
|
||||
this.jsonContent = jsonContent;
|
||||
}
|
||||
|
||||
public String getRewriteDomain() {
|
||||
return rewriteDomain;
|
||||
}
|
||||
|
||||
public void setRewriteDomain(String rewriteDomain) {
|
||||
this.rewriteDomain = rewriteDomain;
|
||||
}
|
||||
|
||||
public Integer getOpenVisit() {
|
||||
return openVisit;
|
||||
}
|
||||
|
||||
public void setOpenVisit(Integer openVisit) {
|
||||
this.openVisit = openVisit;
|
||||
}
|
||||
|
||||
public Integer getDocStatus() {
|
||||
return docStatus;
|
||||
}
|
||||
|
||||
public void setDocStatus(Integer docStatus) {
|
||||
this.docStatus = docStatus;
|
||||
}
|
||||
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Integer getYn() {
|
||||
return yn;
|
||||
}
|
||||
|
||||
public void setYn(Integer yn) {
|
||||
this.yn = yn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiDoc{" +
|
||||
"id=" + id +
|
||||
", name=" + name +
|
||||
", docType=" + docType +
|
||||
", docUrl=" + docUrl +
|
||||
", jsonContent=" + jsonContent +
|
||||
", rewriteDomain=" + rewriteDomain +
|
||||
", openVisit=" + openVisit +
|
||||
", docStatus=" + docStatus +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", yn=" + yn +
|
||||
"}";
|
||||
}
|
||||
|
||||
public String getShareUuid() {
|
||||
return shareUuid;
|
||||
}
|
||||
|
||||
public void setShareUuid(String shareUuid) {
|
||||
this.shareUuid = shareUuid;
|
||||
}
|
||||
|
||||
public String getShareInstruction() {
|
||||
return shareInstruction;
|
||||
}
|
||||
|
||||
public void setShareInstruction(String shareInstruction) {
|
||||
this.shareInstruction = shareInstruction;
|
||||
}
|
||||
|
||||
public Integer getAuthType() {
|
||||
return authType;
|
||||
}
|
||||
|
||||
@@ -15,5 +15,5 @@ import java.util.List;
|
||||
*/
|
||||
public interface ApiGlobalParamService extends IService<ApiGlobalParam> {
|
||||
|
||||
List<ApiGlobalParam> getGlobalParamList();
|
||||
List<ApiGlobalParam> getGlobalParamList(Long docId);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
import java.util.*;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -78,18 +79,8 @@ public class ApiDocServiceImpl extends ServiceImpl<ApiDocMapper, ApiDoc> impleme
|
||||
authType = ApiAuthType.MANAGE.getType();
|
||||
}
|
||||
ApiDocVo apiDocVo = new ApiDocVo();
|
||||
BeanUtil.copyProperties(doc, apiDocVo);
|
||||
apiDocVo.setAuthType(authType);
|
||||
apiDocVo.setId(doc.getId());
|
||||
apiDocVo.setName(doc.getName());
|
||||
apiDocVo.setDocType(doc.getDocType());
|
||||
apiDocVo.setDocUrl(doc.getDocUrl());
|
||||
apiDocVo.setRewriteDomain(doc.getRewriteDomain());
|
||||
apiDocVo.setOpenVisit(doc.getOpenVisit());
|
||||
apiDocVo.setDocStatus(doc.getDocStatus());
|
||||
apiDocVo.setCreateUserId(doc.getCreateUserId());
|
||||
apiDocVo.setCreateUserName(doc.getCreateUserName());
|
||||
apiDocVo.setCreateTime(doc.getCreateTime());
|
||||
apiDocVo.setShareUuid(doc.getShareUuid());
|
||||
return apiDocVo;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiGlobalParam;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.ApiGlobalParamMapper;
|
||||
import com.zyplayer.doc.data.service.manage.ApiGlobalParamService;
|
||||
@@ -8,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -21,9 +24,15 @@ import java.util.List;
|
||||
public class ApiGlobalParamServiceImpl extends ServiceImpl<ApiGlobalParamMapper, ApiGlobalParam> implements ApiGlobalParamService {
|
||||
|
||||
@Override
|
||||
public List<ApiGlobalParam> getGlobalParamList() {
|
||||
public List<ApiGlobalParam> getGlobalParamList(Long docId) {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
Long docIdNew = Optional.ofNullable(docId).orElse(0L);
|
||||
|
||||
QueryWrapper<ApiGlobalParam> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("yn", 1);
|
||||
queryWrapper.eq("doc_id", docIdNew);
|
||||
// 全局参数才按创建人来控制,文档的全局参数大家共用
|
||||
queryWrapper.eq(docIdNew == 0, "create_user_id", currentUser.getUserId());
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user