namespace NetAdmin.Domain.DbMaps.Sys; /// /// 请求日志表 /// [SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(ApiId), nameof(ApiId), false)] [SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(CreatedTime), nameof(CreatedTime), false)] [SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(UserId), nameof(UserId), false)] [SqlIndex(Chars.FLG_DB_INDEX_PREFIX + nameof(HttpStatusCode), nameof(HttpStatusCode), false)] [Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_RequestLog))] public record Sys_RequestLog : SimpleEntity, IFieldCreatedTime, IFieldCreatedClient { /// /// 接口 /// [Ignore] [JsonIgnore] [Navigate(nameof(ApiId))] public Sys_Api Api { get; init; } /// /// 接口编号 /// [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)] [Ignore] [JsonIgnore] public virtual string ApiId { get; init; } /// [Column(Position = -1)] [Ignore] [JsonIgnore] public int? CreatedClientIp { get; init; } /// [Column(ServerTime = DateTimeKind.Local, CanUpdate = false, Position = -1)] [Ignore] [JsonIgnore] public virtual DateTime CreatedTime { get; init; } /// #if DBTYPE_SQLSERVER [Column(Position = -1, DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_1022)] #else [Column(Position = -1, DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)] #endif [Ignore] [JsonIgnore] public virtual string CreatedUserAgent { get; init; } /// /// 执行耗时(微秒) /// [Column] [Ignore] [JsonIgnore] public virtual long Duration { get; init; } /// /// 程序响应码 /// [Column] [Ignore] [JsonIgnore] public virtual ErrorCodes ErrorCode { get; init; } /// /// 异常信息 /// #if DBTYPE_SQLSERVER [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)] #else [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)] #endif [Ignore] [JsonIgnore] public virtual string Exception { get; init; } /// /// HTTP状态码 /// [Column] [Ignore] [JsonIgnore] public virtual int HttpStatusCode { get; init; } /// /// 请求方法 /// [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_15)] [Ignore] [JsonIgnore] public virtual string Method { get; init; } /// /// 请求内容 /// #if DBTYPE_SQLSERVER [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)] #else [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)] #endif [Ignore] [JsonIgnore] public virtual string RequestBody { get; init; } /// /// 请求content-type /// [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)] [Ignore] [JsonIgnore] public virtual string RequestContentType { get; init; } /// /// 请求头信息 /// #if DBTYPE_SQLSERVER [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)] #else [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)] #endif [Ignore] [JsonIgnore] public virtual string RequestHeaders { get; init; } /// /// 请求地址 /// [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_127)] [Ignore] [JsonIgnore] public virtual string RequestUrl { get; init; } /// /// 响应内容 /// #if DBTYPE_SQLSERVER [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)] #else [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)] #endif [Ignore] [JsonIgnore] public virtual string ResponseBody { get; init; } /// /// 响应content-type /// [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_63)] [Ignore] [JsonIgnore] public virtual string ResponseContentType { get; init; } /// /// 响应头 /// #if DBTYPE_SQLSERVER [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)] #else [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)] #endif [Ignore] [JsonIgnore] public virtual string ResponseHeaders { get; init; } /// /// 服务器IP /// [Column] [Ignore] [JsonIgnore] public virtual int? ServerIp { get; init; } /// /// 请求跟踪标识 /// [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_31)] [Ignore] [JsonIgnore] public virtual string TraceId { get; init; } /// /// 用户 /// [Ignore] [JsonIgnore] [Navigate(nameof(UserId))] public Sys_User User { get; init; } /// /// 用户编号 /// [Column] [Ignore] [JsonIgnore] public virtual long? UserId { get; init; } }