Merge pull request #7239 from dataease/pr@dev-v2@perf_api_doc_sys

perf: 系统设置api接口文档
This commit is contained in:
fit2cloud-chenyw 2023-12-20 17:57:29 +08:00 committed by GitHub
commit 055ff852b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 61 additions and 12 deletions

View File

@ -63,3 +63,4 @@ knife4j:
enable: true enable: true
setting: setting:
language: zh_cn language: zh_cn
enable-swagger-models: false

View File

@ -1,18 +1,23 @@
package io.dataease.api.map; package io.dataease.api.map;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.api.map.dto.GeometryNodeCreator; import io.dataease.api.map.dto.GeometryNodeCreator;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@Tag(name = "地理信息") @Tag(name = "系统设置:地理信息")
@ApiSupport(order = 798)
public interface GeoApi { public interface GeoApi {
@Operation(summary = "保存地理信息")
@PostMapping(value = "/save", consumes = {"multipart/form-data"}) @PostMapping(value = "/save", consumes = {"multipart/form-data"})
void saveMapGeo(@RequestPart("request") GeometryNodeCreator request, @RequestPart(value = "file") MultipartFile file); void saveMapGeo(@RequestPart("request") GeometryNodeCreator request, @RequestPart(value = "file") MultipartFile file);
@Operation(summary = "删除地理信息")
@PostMapping("/delete/{id}") @PostMapping("/delete/{id}")
void deleteGeo(@PathVariable("id") String id); void deleteGeo(@PathVariable("id") String id);
} }

View File

@ -1,17 +1,21 @@
package io.dataease.api.map; package io.dataease.api.map;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.api.map.vo.AreaNode; import io.dataease.api.map.vo.AreaNode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import java.util.List; import java.util.List;
@Tag(name = "地图") @Tag(name = "系统设置:地图区域")
@ApiSupport(order = 797)
public interface MapApi { public interface MapApi {
/** /**
* 获取世界树 * 获取世界树
* @return * @return
*/ */
@Operation(summary = "查询区域树")
@GetMapping("/worldTree") @GetMapping("/worldTree")
AreaNode getWorldTree(); AreaNode getWorldTree();
} }

View File

@ -1,15 +1,17 @@
package io.dataease.api.map.dto; package io.dataease.api.map.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@Schema(description = "地理信息构造器")
@Data @Data
public class GeometryNodeCreator implements Serializable { public class GeometryNodeCreator implements Serializable {
@Schema(description = "区域代码")
private String code; private String code;
@Schema(description = "区域名称")
private String name; private String name;
@Schema(description = "上级区域代码")
private String pid; private String pid;
} }

View File

@ -1,6 +1,7 @@
package io.dataease.api.map.vo; package io.dataease.api.map.vo;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -8,23 +9,31 @@ import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
@Schema(description = "区域节点")
@Data @Data
@Builder @Builder
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class AreaNode implements Serializable { public class AreaNode implements Serializable {
@Serial @Serial
private static final long serialVersionUID = -2285934203102231711L; private static final long serialVersionUID = -2285934203102231711L;
@Schema(description = "ID")
private String id; private String id;
@Schema(description = "级别")
private String level; private String level;
@Schema(description = "名称")
private String name; private String name;
@Schema(description = "上级ID")
private String pid; private String pid;
@Schema(description = "是否自定义节点")
private boolean custom = false; private boolean custom = false;
/** /**
* 国家代码 * 国家代码
*/ */
@Schema(description = "国家代码")
private String country; private String country;
/** /**
* 下属区域 * 下属区域
*/ */
@Schema(description = "子集")
private List<AreaNode> children; private List<AreaNode> children;
} }

View File

@ -1,7 +1,12 @@
package io.dataease.api.system; package io.dataease.api.system;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.api.system.request.OnlineMapEditor; import io.dataease.api.system.request.OnlineMapEditor;
import io.dataease.api.system.vo.SettingItemVO; import io.dataease.api.system.vo.SettingItemVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -9,20 +14,28 @@ import org.springframework.web.bind.annotation.RequestBody;
import java.util.List; import java.util.List;
@Tag(name = "系统设置:系统参数")
@ApiSupport(order = 799)
public interface SysParameterApi { public interface SysParameterApi {
@Operation(summary = "查询单个配置值")
@Parameter(name = "key", description = "配置key", required = true, in = ParameterIn.PATH)
@GetMapping("/singleVal/{key}") @GetMapping("/singleVal/{key}")
String singleVal(@PathVariable("key") String key); String singleVal(@PathVariable("key") String key);
@Operation(summary = "保存在线地图")
@PostMapping("/saveOnlineMap") @PostMapping("/saveOnlineMap")
void saveOnlineMap(@RequestBody OnlineMapEditor editor); void saveOnlineMap(@RequestBody OnlineMapEditor editor);
@Operation(summary = "查询在线地图")
@GetMapping("/queryOnlineMap") @GetMapping("/queryOnlineMap")
String queryOnlineMap(); String queryOnlineMap();
@Operation(summary = "查询基础设置(非xpack)")
@GetMapping("basic/query") @GetMapping("basic/query")
List<SettingItemVO> queryBasicSetting(); List<SettingItemVO> queryBasicSetting();
@Operation(summary = "保存基础设置(非xpack)")
@PostMapping("/basic/save") @PostMapping("/basic/save")
void saveBasicSetting(@RequestBody List<SettingItemVO> settingItemVOS); void saveBasicSetting(@RequestBody List<SettingItemVO> settingItemVOS);

View File

@ -1,11 +1,13 @@
package io.dataease.api.system.request; package io.dataease.api.system.request;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@Schema(description = "在线地图构造器")
@Data @Data
public class OnlineMapEditor implements Serializable { public class OnlineMapEditor implements Serializable {
@Schema(description = "在线地图key", requiredMode = Schema.RequiredMode.REQUIRED)
private String key; private String key;
} }

View File

@ -1,19 +1,21 @@
package io.dataease.api.system.vo; package io.dataease.api.system.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
@Schema(description = "基础设置参数项")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
public class SettingItemVO implements Serializable { public class SettingItemVO implements Serializable {
@Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED)
private String pkey; private String pkey;
@Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED)
private String pval; private String pval;
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED)
private String type; private String type;
@Schema(description = "顺序", requiredMode = Schema.RequiredMode.REQUIRED)
private Integer sort; private Integer sort;
} }

View File

@ -69,15 +69,26 @@ public class SwaggerConfig {
return GroupedOpenApi.builder().group("4-datasource").displayName("数据源管理").packagesToScan("io.dataease.datasource").build(); return GroupedOpenApi.builder().group("4-datasource").displayName("数据源管理").packagesToScan("io.dataease.datasource").build();
} }
@Bean
public GroupedOpenApi basicSettingApi() {
String[] packageArray = {
"io.dataease.system",
"io.dataease.map",
};
return GroupedOpenApi.builder().group("5-xpackpermission").displayName("系统设置").packagesToScan(packageArray).build();
}
@Bean @Bean
public GroupedOpenApi baseXpackApi() { public GroupedOpenApi baseXpackApi() {
return GroupedOpenApi.builder().group("5-xpackbase").displayName("基础xpack").packagesToScan("io.dataease.xpack.base").build(); return GroupedOpenApi.builder().group("6-xpackbase").displayName("基础xpack").packagesToScan("io.dataease.xpack.base").build();
} }
@Bean @Bean
public GroupedOpenApi systemApi() { public GroupedOpenApi systemApi() {
return GroupedOpenApi.builder().group("6-xpackpermission").displayName("权限相关xpack").packagesToScan("io.dataease.xpack.permissions").build(); return GroupedOpenApi.builder().group("7-xpackpermission").displayName("权限相关xpack").packagesToScan("io.dataease.xpack.permissions").build();
} }
} }