🎉 优化swagger配置逻辑

This commit is contained in:
smallchill 2024-04-26 00:24:43 +08:00
parent e2dceaef0f
commit ff7cf290c5
3 changed files with 16 additions and 10 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -8,6 +8,8 @@ springdoc:
api-docs:
enabled: true
path: /v3/api-docs
# 默认是false需要设置为true
default-flat-param-object: true
#knife4j配置
knife4j: