补充Swagger文档

This commit is contained in:
2025-10-13 08:58:53 +08:00
parent 0f6dedc70f
commit d866d5bed2
@@ -2,6 +2,7 @@ package xyz.thewhitedog9487.WebAPI.Data.Entity;
import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
@@ -22,63 +23,95 @@ import java.time.Instant;
@NoArgsConstructor @NoArgsConstructor
@Entity @Entity
@Table @Table
@Schema(description = "访问日志条目")
public class AccessLog{ public class AccessLog{
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(nullable = false) @Column(nullable = false)
@JsonProperty("ID") @JsonProperty("ID")
@Schema(description = "主键", example = "1")
Long ID; Long ID;
@JsonProperty("RequestID") @JsonProperty("RequestID")
@Schema(description = "Servlet请求ID", example = "0")
String RequestID; String RequestID;
@JsonProperty("CF_Connecting_IP") @JsonProperty("CF_Connecting_IP")
@Column(name = "\"CF-Connecting-IP\"") @Column(name = "\"CF-Connecting-IP\"")
@Schema(description = "Cloudflare提供的请求IP", example = "2409:9802:74a3:6eff:3cae:5cba:25ac:788a")
String CF_Connecting_IP; String CF_Connecting_IP;
@JsonProperty("X_Forwarded_For") @JsonProperty("X_Forwarded_For")
@Column(name = "\"X-Forwarded-For\"") @Column(name = "\"X-Forwarded-For\"")
@Schema(description = "X-Forwarded-For请求头提供的请求IP", example = "2409:9802:74a3:6eff:3cae:5cba:25ac:788a, 108.162.245.89")
String X_Forwarded_For; String X_Forwarded_For;
@JsonProperty("RemoteAddress") @JsonProperty("RemoteAddress")
@Schema(description = "Servlet报告的请求IP", example = "192.168.128.11")
String RemoteAddress; String RemoteAddress;
@JsonProperty("CF_IPCountry") @JsonProperty("CF_IPCountry")
@Column(name = "\"CF-IPCountry\"") @Column(name = "\"CF-IPCountry\"")
@Schema(description = "Cloudflare提供的请求国家代码", example = "CN")
String CF_IPCountry; String CF_IPCountry;
@JsonProperty("ISO3166") @JsonProperty("ISO3166")
@Schema(description = "Java内部根据CF-IPCountry得到的对应ISO3166代码", example = "CHN")
String ISO3166; String ISO3166;
@JsonProperty("UserAgent") @JsonProperty("UserAgent")
@Schema(description = "标准HTTP User-Agent请求头", example = "IntelliJ HTTP Client/IntelliJ IDEA 2025.2.2")
String UserAgent; String UserAgent;
@JsonProperty("HttpMethod") @JsonProperty("HttpMethod")
@Schema(description = "HTTP请求方法", example = "GET")
String HttpMethod; String HttpMethod;
@JsonProperty("Protocol") @JsonProperty("Protocol")
@Schema(description = "请求协议", example = "http")
String Protocol; String Protocol;
@JsonProperty("ProtocolVersion") @JsonProperty("ProtocolVersion")
@Schema(description = "协议版本", example = "HTTP/1.1")
String ProtocolVersion; String ProtocolVersion;
@JsonProperty("URL") @JsonProperty("URL")
@Schema(description = "请求的完整URL", example = "http://dev.thewhitedog9487.xyz/ip/ip")
String URL; String URL;
@JsonProperty("QueryString") @JsonProperty("QueryString")
@Schema(description = "查询字符串", example = "")
String QueryString; String QueryString;
@JsonProperty("Header") @JsonProperty("Header")
@Column(columnDefinition = "text") @Column(columnDefinition = "text")
@Schema(description = "所有HTTP请求头的JSON化字符串", example = "host: dev.thewhitedog9487.xyz\n" +
"x-real-ip: 108.42.101.215\n" +
"x-forwarded-for: 2409:3e5a:642:1f64:a9d4:c96c:72d1:88ef, 108.42.101.215\n" +
"x-forwarded-proto: https\n" +
"connection: close\n" +
"x-api-key: 985651Fardsh6452453sdcv\n" +
"user-agent: IntelliJ HTTP Client/IntelliJ IDEA 2025.2.3\n" +
"accept: */*\n" +
"cf-ray: 98b487dc1dead465-SEA\n" +
"accept-encoding: gzip, br\n" +
"cdn-loop: cloudflare; loops=1\n" +
"cf-connecting-ip: 2409:3e5a:642:1f64:a9d4:c96c:72d1:88ef\n" +
"cf-ipcountry: CN\n" +
"cf-visitor: {\"scheme\":\"https\"}\n" +
"cookie: JSESSIONID=59DB3634C2FB313AFFEE54D4F933F101")
String Header; String Header;
@JsonProperty("Timestamp") @JsonProperty("Timestamp")
@Schema(description = "请求时间的Unix时间戳", example = "1758437539600")
Instant Timestamp; Instant Timestamp;
@JsonProperty("ResponseStatusCode") @JsonProperty("ResponseStatusCode")
@Schema(description = "响应的HTTP状态码", example = "200")
Integer ResponseStatusCode; Integer ResponseStatusCode;
@JsonProperty("ResponseBody") @JsonProperty("ResponseBody")
@Column(columnDefinition = "text") @Column(columnDefinition = "text")
@Schema(description = "响应内容", example = "")
String ResponseBody; String ResponseBody;
} }