From ff7cf290c59265cafba837fe461ed6694401cf05 Mon Sep 17 00:00:00 2001 From: smallchill Date: Fri, 26 Apr 2024 00:24:43 +0800 Subject: [PATCH] =?UTF-8?q?:tada:=20=E4=BC=98=E5=8C=96swagger=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/springblade/core/mp/base/BaseEntity.java | 14 +++++++------- .../core/swagger/SwaggerLauncherServiceImpl.java | 10 +++++++--- .../src/main/resources/blade-swagger.yml | 2 ++ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseEntity.java b/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseEntity.java index a276aed..da07684 100644 --- a/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseEntity.java +++ b/blade-core-mybatis/src/main/java/org/springblade/core/mp/base/BaseEntity.java @@ -50,14 +50,14 @@ public class BaseEntity implements Serializable { * 创建人 */ @JsonSerialize(using = ToStringSerializer.class) - @Schema(description = "创建人") + @Schema(description = "创建人", hidden = true) private Long createUser; /** * 创建部门 */ @JsonSerialize(using = ToStringSerializer.class) - @Schema(description = "创建部门") + @Schema(description = "创建部门", hidden = true) private Long createDept; /** @@ -65,14 +65,14 @@ public class BaseEntity implements Serializable { */ @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) - @Schema(description = "创建时间") + @Schema(description = "创建时间", hidden = true) private Date createTime; /** * 更新人 */ @JsonSerialize(using = ToStringSerializer.class) - @Schema(description = "更新人") + @Schema(description = "更新人", hidden = true) private Long updateUser; /** @@ -80,19 +80,19 @@ public class BaseEntity implements Serializable { */ @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) - @Schema(description = "更新时间") + @Schema(description = "更新时间", hidden = true) private Date updateTime; /** * 状态[1:正常] */ - @Schema(description = "业务状态") + @Schema(description = "业务状态", hidden = true) private Integer status; /** * 状态[0:未删除,1:删除] */ @TableLogic - @Schema(description = "是否已删除") + @Schema(description = "是否已删除", hidden = true) private Integer isDeleted; } diff --git a/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerLauncherServiceImpl.java b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerLauncherServiceImpl.java index d9f903c..97ca842 100644 --- a/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerLauncherServiceImpl.java +++ b/blade-core-swagger/src/main/java/org/springblade/core/swagger/SwaggerLauncherServiceImpl.java @@ -34,11 +34,15 @@ public class SwaggerLauncherServiceImpl implements LauncherService { public void launcher(SpringApplicationBuilder builder, String appName, String profile) { Properties props = System.getProperties(); if (profile.equals(AppConstant.PROD_CODE)) { - props.setProperty("knife4j.production", "true"); props.setProperty("swagger.enabled", "false"); + props.setProperty("knife4j.enable", "false"); + props.setProperty("knife4j.production", "true"); + } else { + props.setProperty("swagger.enabled", "true"); + props.setProperty("knife4j.enable", "true"); + props.setProperty("knife4j.production", "false"); + props.setProperty("spring.mvc.pathmatch.matching-strategy", "ANT_PATH_MATCHER"); } - props.setProperty("knife4j.enable", "true"); - props.setProperty("spring.mvc.pathmatch.matching-strategy", "ANT_PATH_MATCHER"); } @Override diff --git a/blade-core-swagger/src/main/resources/blade-swagger.yml b/blade-core-swagger/src/main/resources/blade-swagger.yml index d621371..2633330 100644 --- a/blade-core-swagger/src/main/resources/blade-swagger.yml +++ b/blade-core-swagger/src/main/resources/blade-swagger.yml @@ -8,6 +8,8 @@ springdoc: api-docs: enabled: true path: /v3/api-docs + # 默认是false,需要设置为true + default-flat-param-object: true #knife4j配置 knife4j: