This commit is contained in:
2025-11-03 17:03:57 +08:00
commit 7a04b85667
16804 changed files with 2492292 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HardwarePerformance.Core.Entities
{
/// <summary>
/// 产品类别实体
/// </summary>
public class Category : Infrastructure.Data.BaseEntity
{
public int Id { get; set; }
[Required]
[MaxLength(100)]
public string Name { get; set; } = string.Empty;
[MaxLength(500)]
public string? Description { get; set; }
/// <summary>
/// 类别图标URL
/// </summary>
[MaxLength(500)]
public string? IconUrl { get; set; }
/// <summary>
/// 排序顺序
/// </summary>
public int SortOrder { get; set; }
/// <summary>
/// 是否启用
/// </summary>
public bool IsActive { get; set; } = true;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
/// <summary>
/// 更新时间
/// </summary>
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
// 导航属性
public virtual ICollection<Product> Products { get; set; } = new List<Product>();
[NotMapped]
public int ProductCount => Products?.Count ?? 0;
}
}

View File

@@ -0,0 +1,56 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HardwarePerformance.Core.Entities
{
/// <summary>
/// 数据源实体
/// </summary>
public class DataSource : Infrastructure.Data.BaseEntity
{
public int Id { get; set; }
[Required]
[MaxLength(100)]
public string Name { get; set; } = string.Empty;
[MaxLength(500)]
public string? Description { get; set; }
/// <summary>
/// 数据源URL
/// </summary>
[MaxLength(500)]
public string? Url { get; set; }
/// <summary>
/// 数据源类型GeekBench、3DMark、AnTuTu等
/// </summary>
[Required]
[MaxLength(50)]
public string Type { get; set; } = string.Empty;
/// <summary>
/// 是否启用
/// </summary>
public bool IsActive { get; set; } = true;
/// <summary>
/// 最后同步时间
/// </summary>
public DateTime? LastSyncAt { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
/// <summary>
/// 更新时间
/// </summary>
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
// 导航属性
public virtual ICollection<PerformanceScore> PerformanceScores { get; set; } = new List<PerformanceScore>();
}
}

View File

@@ -0,0 +1,58 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HardwarePerformance.Core.Entities
{
/// <summary>
/// 性能分数实体
/// </summary>
public class PerformanceScore : Infrastructure.Data.BaseEntity
{
public int Id { get; set; }
/// <summary>
/// 测试项目名称CPU单核、CPU多核、GPU等
/// </summary>
[Required]
[MaxLength(100)]
public string TestName { get; set; } = string.Empty;
/// <summary>
/// 测试分数
/// </summary>
public int Score { get; set; }
/// <summary>
/// 测试单位
/// </summary>
[MaxLength(20)]
public string? Unit { get; set; }
/// <summary>
/// 测试版本
/// </summary>
[MaxLength(50)]
public string? TestVersion { get; set; }
/// <summary>
/// 测试日期
/// </summary>
public DateTime TestDate { get; set; } = DateTime.UtcNow;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// 外键
public int ProductId { get; set; }
public int DataSourceId { get; set; }
// 导航属性
[ForeignKey("ProductId")]
public virtual Product Product { get; set; } = null!;
[ForeignKey("DataSourceId")]
public virtual DataSource DataSource { get; set; } = null!;
}
}

View File

@@ -0,0 +1,85 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HardwarePerformance.Core.Entities
{
/// <summary>
/// 产品实体
/// </summary>
public class Product : Infrastructure.Data.BaseEntity
{
public int Id { get; set; }
[Required]
[MaxLength(200)]
public string Name { get; set; } = string.Empty;
[Required]
[MaxLength(200)]
public string Model { get; set; } = string.Empty;
[Required]
[MaxLength(100)]
public string Manufacturer { get; set; } = string.Empty;
/// <summary>
/// 产品图片URL
/// </summary>
[MaxLength(500)]
public string? ImageUrl { get; set; }
/// <summary>
/// 产品描述
/// </summary>
[MaxLength(2000)]
public string? Description { get; set; }
/// <summary>
/// 发布年份
/// </summary>
public int ReleaseYear { get; set; }
/// <summary>
/// 发布日期
/// </summary>
public DateTime? ReleaseDate { get; set; }
/// <summary>
/// 综合性能分数
/// </summary>
public int PerformanceScore { get; set; }
/// <summary>
/// 当前排名
/// </summary>
public int? CurrentRank { get; set; }
/// <summary>
/// 是否启用
/// </summary>
public bool IsActive { get; set; } = true;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
/// <summary>
/// 更新时间
/// </summary>
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
// 外键
public int CategoryId { get; set; }
// 导航属性
[ForeignKey("CategoryId")]
public virtual Category Category { get; set; } = null!;
public virtual ICollection<PerformanceScore> PerformanceScores { get; set; } = new List<PerformanceScore>();
public virtual ICollection<Specification> Specifications { get; set; } = new List<Specification>();
public virtual ICollection<RankingHistory> RankingHistories { get; set; } = new List<RankingHistory>();
}
}

View File

@@ -0,0 +1,40 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HardwarePerformance.Core.Entities
{
/// <summary>
/// 排名历史实体
/// </summary>
public class RankingHistory : Infrastructure.Data.BaseEntity
{
public int Id { get; set; }
/// <summary>
/// 排名
/// </summary>
public int Rank { get; set; }
/// <summary>
/// 性能分数
/// </summary>
public int Score { get; set; }
/// <summary>
/// 记录日期
/// </summary>
public DateTime RecordDate { get; set; } = DateTime.UtcNow;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// 外键
public int ProductId { get; set; }
// 导航属性
[ForeignKey("ProductId")]
public virtual Product Product { get; set; } = null!;
}
}

View File

@@ -0,0 +1,67 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HardwarePerformance.Core.Entities
{
/// <summary>
/// 产品规格参数实体
/// </summary>
public class Specification : Infrastructure.Data.BaseEntity
{
public int Id { get; set; }
/// <summary>
/// 规格组名称(如:处理器规格、图形规格等)
/// </summary>
[Required]
[MaxLength(100)]
public string GroupName { get; set; } = string.Empty;
/// <summary>
/// 规格名称
/// </summary>
[Required]
[MaxLength(100)]
public string Name { get; set; } = string.Empty;
/// <summary>
/// 规格值
/// </summary>
[Required]
[MaxLength(500)]
public string Value { get; set; } = string.Empty;
/// <summary>
/// 规格单位
/// </summary>
[MaxLength(20)]
public string? Unit { get; set; }
/// <summary>
/// 是否为关键规格(用于对比时高亮显示)
/// </summary>
public bool IsKeySpecification { get; set; } = false;
/// <summary>
/// 排序顺序
/// </summary>
public int SortOrder { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
/// <summary>
/// 更新时间
/// </summary>
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
// 外键
public int ProductId { get; set; }
// 导航属性
[ForeignKey("ProductId")]
public virtual Product Product { get; set; } = null!;
}
}