using ZR.Mall.Enum;
using ZR.Model.System;
namespace ZR.Mall.Model
{
///
/// 商品管理
///
[SugarTable("mms_product", "商品管理")]
[Tenant("1")]
public class Product : SysBase
{
///
/// 商品ID
///
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public long ProductId { get; set; }
///
/// 商品名
///
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)]
public string ProductName { get; set; }
///
/// 商品编码
///
public string ProductCode { get; set; }
///
/// 介绍
///
public string Introduce { get; set; }
///
/// 品牌Id
///
public long? BrandId { get; set; }
///
/// 商品分类
///
public int? CategoryId { get; set; }
///
/// sku最低价格(自动根据sku计算)
///
public decimal Price { get; set; }
///
/// 最高价格(用于前端搜索价格区间)自动根据sku计算
///
public decimal MaxPrice { get; set; }
///
/// 商品原件(划线价)
///
public decimal OriginalPrice { get; set; }
///
/// 单位 (如:件,瓶,斤)
///
public string Unit { get; set; }
///
/// 轮播图片
///
[SugarColumn(Length = 2000)]
public string ImageUrls { get; set; }
///
/// 商品主图
///
public string MainImage { get; set; }
///
/// 视频介绍
///
public string VideoUrl { get; set; }
///
/// 销量统计(可加缓存)
///
public int TotalSalesVolume { get; set; }
///
/// 排序ID (越大排序越靠前)
///
[SugarColumn(DefaultValue = "0")]
public int SortId { get; set; } = 0;
///
/// 显示状态 1.在售 0.下架
///
[SugarColumn(DefaultValue = "0", ExtendedAttribute = ProteryConstant.NOTNULL)]
public SaleStatus SaleStatus { get; set; }
///
/// 添加时间
///
[SugarColumn(InsertServerTime = true)]
public DateTime? AddTime { get; set; }
///
/// 详情页富文本
///
[SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string DetailsHtml { get; set; }
///
/// 是否删除
///
[SugarColumn(DefaultValue = "0")]
public int IsDelete { get; set; }
///
/// 规格简介(只读,存档使用)
///
public string SpecSummary { get; set; }
///
/// 规格类型
///
public SpecType SpecType { get; set; } = SpecType.Multiple;
///
/// 限购
///
[SugarColumn(IsJson = true)]
public PurchaseLimit PurchaseLimit { get; set; } = new PurchaseLimit();
///
/// sku
///
[Navigate(NavigateType.OneToMany, nameof(ProductId), nameof(Model.Skus.ProductId))] //自定义关系映射
public List Skus { get; set; }
///
/// 分类
///
[Navigate(NavigateType.OneToOne, nameof(CategoryId), nameof(Model.Category.CategoryId))] //自定义关系映射
public Category Category { get; set; }
///
/// 品牌
///
[Navigate(NavigateType.OneToOne, nameof(BrandId), nameof(Model.Brand.Id))] //自定义关系映射
public Brand Brand { get; set; }
}
public class PurchaseLimit
{
public bool Limit { get; set; }
///
/// 总限购件数
///
public int TotalLimit { get; set; }
///
/// 每单限购
///
public int SingleLimit { get; set; }
}
}