添加项目文件。
This commit is contained in:
77
Atomx.Admin/Atomx.Admin.Client/Models/ProductSkuModel.cs
Normal file
77
Atomx.Admin/Atomx.Admin.Client/Models/ProductSkuModel.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using Atomx.Utils.Extension;
|
||||
|
||||
namespace Atomx.Admin.Client.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 产品SKU信息模型
|
||||
/// </summary>
|
||||
public class ProductSkuModel : IEquatable<ProductSkuModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// 属性ID
|
||||
/// </summary>
|
||||
public long AttributeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 属性名称
|
||||
/// </summary>
|
||||
public string AttributeName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 属性值ID
|
||||
/// </summary>
|
||||
public long ValueId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 属性值 Name
|
||||
/// </summary>
|
||||
public string ValueName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 重量
|
||||
/// </summary>
|
||||
public decimal Weight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 重量单位,1毫克mg,2克g,3千克kg,4吨t,5磅lb,6盎司oz
|
||||
/// </summary>
|
||||
public int WeightUnit { get; set; }
|
||||
|
||||
public bool Equals(ProductSkuModel? other)
|
||||
{
|
||||
if (other is null) return false;
|
||||
if (ValueId != other.ValueId)
|
||||
{
|
||||
return AttributeId == other.AttributeId &&
|
||||
ValueId == other.ValueId &&
|
||||
Weight.RemoveTrailingZeros() == other.Weight.RemoveTrailingZeros() &&
|
||||
WeightUnit == other.WeightUnit &&
|
||||
AttributeName == other.AttributeName &&
|
||||
ValueName == other.ValueName;
|
||||
}
|
||||
else
|
||||
{
|
||||
return AttributeId == other.AttributeId &&
|
||||
ValueId == other.ValueId &&
|
||||
AttributeName == other.AttributeName;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals(object obj) => Equals(obj as ProductSkuModel);
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
int hash = 17;
|
||||
hash = hash * 23 + AttributeId.GetHashCode();
|
||||
hash = hash * 23 + ValueId.GetHashCode();
|
||||
hash = hash * 23 + Weight.GetHashCode();
|
||||
hash = hash * 23 + WeightUnit.GetHashCode();
|
||||
hash = hash * 23 + (AttributeName?.GetHashCode() ?? 0);
|
||||
hash = hash * 23 + (ValueName?.GetHashCode() ?? 0);
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user