TProductSku.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using SqlSugar;
  2. namespace EasyTemplate.Tool.Entity;
  3. /// <summary>
  4. /// 规格
  5. /// </summary>
  6. [SugarTable(null, "规格")]
  7. [SugarIndex("ProductId", nameof(ProductId), OrderByType.Desc)]
  8. public partial class TProductSku: EntityBase
  9. {
  10. /// <summary>
  11. /// 商品Id
  12. /// </summary>
  13. [SugarColumn(ColumnDescription = "商品Id", IsNullable = true)]
  14. public long ProductId { get; set; }
  15. /// <summary>
  16. /// 属性id列表
  17. /// </summary>
  18. [SugarColumn(ColumnDescription = "属性id列表", IsNullable = true)]
  19. public string PropertyIds { get; set; }
  20. /// <summary>
  21. /// 规格名称
  22. /// </summary>
  23. [SugarColumn(ColumnDescription = "规格名称", IsNullable = true)]
  24. public string PropertyName { get; set; }
  25. /// <summary>
  26. /// 规格编码
  27. /// </summary>
  28. [SugarColumn(ColumnDescription = "规格编码", IsNullable = true)]
  29. public string Code { get; set; }
  30. /// <summary>
  31. /// 预览图
  32. /// </summary>
  33. [SugarColumn(ColumnDescription = "规格图", IsNullable = true)]
  34. public string Image { get; set; }
  35. /// <summary>
  36. /// 价格
  37. /// </summary>
  38. [SugarColumn(ColumnDescription = "价格", DefaultValue = "0", DecimalDigits =2, IsNullable = true)]
  39. public decimal Price { get; set; }
  40. /// <summary>
  41. /// 成本价
  42. /// </summary>
  43. [SugarColumn(ColumnDescription = "成本价", DefaultValue = "0", DecimalDigits = 2, IsNullable = true)]
  44. public decimal Cost { get; set; }
  45. /// <summary>
  46. /// 总库存
  47. /// </summary>
  48. [SugarColumn(ColumnDescription = "库存", DefaultValue = "0", IsNullable = true)]
  49. public int Stock { get; set; }
  50. }
  51. public class TProductSkuSeedData : ISeedData<TProductSku>
  52. {
  53. public IEnumerable<TProductSku> Generate()
  54. =>
  55. [
  56. new TProductSku() { Id = 1, ProductId=1, PropertyName="红色/水果", PropertyIds="4,8", Code="S20250827135434201-1", Image="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", Cost=2.50M, Price=9.99M, Stock=999 },
  57. new TProductSku() { Id = 1, ProductId=1, PropertyName="红色/可乐", PropertyIds="4,9", Code="S20250827135434202-2", Image="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", Cost=2.50M, Price=9.99M, Stock=999 },
  58. new TProductSku() { Id = 1, ProductId=1, PropertyName="绿色/水果", PropertyIds="5,8", Code="S20250827135434203-3", Image="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", Cost=2.50M, Price=9.99M, Stock=999 },
  59. new TProductSku() { Id = 1, ProductId=1, PropertyName="绿色/可乐", PropertyIds="5,9", Code="S20250827135434204-4", Image="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", Cost=2.50M, Price=9.99M, Stock=999 },
  60. new TProductSku() { Id = 1, ProductId=1, PropertyName="黄色/水果", PropertyIds="6,8", Code="S20250827135434205-5", Image="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", Cost=2.50M, Price=9.99M, Stock=999 },
  61. new TProductSku() { Id = 1, ProductId=1, PropertyName="黄色/可乐", PropertyIds="6,9", Code="S20250827135434206-6", Image="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", Cost=2.50M, Price=9.99M, Stock=999 },
  62. ];
  63. }