From 2a54a62a031d96a7db231d8e28581f72b1f90c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=91=E5=B9=B4=E6=A2=A6=E4=B8=8E=E7=A0=96?= <2847127106@qq.com> Date: Wed, 7 Aug 2024 11:33:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=9F=E4=B8=80=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=AE=9E=E4=BD=93=E7=B1=BB=E5=92=8CBese=E5=9F=BA?= =?UTF-8?q?=E7=B1=BB=E7=9A=84swaggers=E6=8F=8F=E8=BF=B0=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/muyu/common/core/domain/Result.java | 19 ++++++++++++++ .../common/core/web/domain/BaseEntity.java | 25 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/src/main/java/com/muyu/common/core/domain/Result.java b/src/main/java/com/muyu/common/core/domain/Result.java index 70faa40..6b2744e 100644 --- a/src/main/java/com/muyu/common/core/domain/Result.java +++ b/src/main/java/com/muyu/common/core/domain/Result.java @@ -2,6 +2,7 @@ package com.muyu.common.core.domain; import com.muyu.common.core.constant.Constants; import com.muyu.common.core.constant.HttpStatus; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -33,10 +34,28 @@ public class Result implements Serializable { public static final int WARN = HttpStatus.WARN; private static final long serialVersionUID = 1L; + + @Schema( + name = "code", + title = "返回状态码", + type = "int", + description = "请求后台返回的状态码 200表示成功 500表示服务器错误" + ) private int code; + @Schema( + name = "msg", + title = "返回状态信息", + type = "String", + description = "请求后台返回的状态详细信息" + ) private String msg; + @Schema( + name = "data", + title = "返回对象", + description = "请求后台返回的对象" + ) private T data; public static Result success () { diff --git a/src/main/java/com/muyu/common/core/web/domain/BaseEntity.java b/src/main/java/com/muyu/common/core/web/domain/BaseEntity.java index add8e3e..089b889 100644 --- a/src/main/java/com/muyu/common/core/web/domain/BaseEntity.java +++ b/src/main/java/com/muyu/common/core/web/domain/BaseEntity.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -36,22 +37,46 @@ public class BaseEntity implements Serializable { /** * 创建者 */ + @Schema( + name = "createBy", + title = "创建人", + type = "String", + description = "创建数据的用户" + ) private String createBy; /** * 创建时间 */ + @Schema( + name = "createTime", + title = "创建时间", + type = "Date", + description = "创建数据的时间" + ) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; /** * 更新者 */ + @Schema( + name = "updateBy", + title = "更新者", + type = "String", + description = "更新数据的用户" + ) private String updateBy; /** * 更新时间 */ + @Schema( + name = "updateTime", + title = "更新时间", + type = "Date", + description = "更新数据的时间" + ) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime;