swagger文档支持禁用和启用

This commit is contained in:
暮光:城中城
2019-09-20 20:53:24 +08:00
parent 93e6575a18
commit 7f15b7e23e
3 changed files with 46 additions and 1 deletions

View File

@@ -449,6 +449,29 @@ public class MgDocumentController {
return DocResponseJson.ok();
}
/**
* 禁用或启用/v2/api-docs
*
* @author 暮光:城中城
* @since 2018年8月21日
* @param location 文档地址
* @param disable 0=启用 1=禁用
* @return 结果
*/
@Deprecated
@PostMapping(value = "/disableSwaggerDoc")
public ResponseJson<Object> disableSwaggerDoc(String location, Integer disable) {
List<LocationListVo> locationList = this.getLocationSet();
String locationDel = this.encodeUrlParam(location);
for (LocationListVo locationVo : locationList) {
if (Objects.equals(locationVo.getLocation(), locationDel)) {
locationVo.setDisabled(Objects.equals(1, disable) ? 1 : 0);
}
}
this.storageSwaggerLocationList(locationList);
return DocResponseJson.ok();
}
/**
* 获取swaggerLocation列表
*
@@ -459,6 +482,7 @@ public class MgDocumentController {
@PostMapping(value = "/getLocationList")
public ResponseJson<List<LocationListVo>> getLocationList() {
List<LocationListVo> locationSet = this.getLocationSet();
locationSet = locationSet.stream().filter(val -> val.getDisabled() == null || val.getDisabled() == 0).collect(Collectors.toList());
return DocResponseJson.ok(locationSet);
}

View File

@@ -10,6 +10,7 @@ public class LocationListVo {
private String name;
private String uuid;
private String location;
private Integer disabled;
private String resources;
private Integer openVisit;
private String customName;
@@ -111,4 +112,12 @@ public class LocationListVo {
public void setCustomName(String customName) {
this.customName = customName;
}
public Integer getDisabled() {
return disabled;
}
public void setDisabled(Integer disabled) {
this.disabled = disabled;
}
}