TProduct.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using SqlSugar;
  2. namespace EasyTemplate.Tool.Entity;
  3. /// <summary>
  4. /// 商品
  5. /// </summary>
  6. [SugarTable(null, "商品")]
  7. [SugarIndex("CreateTime", nameof(CreateTime), OrderByType.Desc)]
  8. public partial class TProduct: EntityBase
  9. {
  10. /// <summary>
  11. /// 商品名称
  12. /// </summary>
  13. [SugarColumn(ColumnDescription = "商品名称", IsNullable = true)]
  14. public string Name { get; set; }
  15. /// <summary>
  16. /// 总库存
  17. /// </summary>
  18. [SugarColumn(ColumnDescription = "商品编码", IsNullable = true)]
  19. public string Code { get; set; }
  20. /// <summary>
  21. /// 预览图
  22. /// </summary>
  23. [SugarColumn(ColumnDataType = "text", ColumnDescription = "预览图", IsNullable = true)]
  24. public string Preview { get; set; }
  25. /// <summary>
  26. /// 是否可用
  27. /// </summary>
  28. [SugarColumn(ColumnDescription = "是否可用", DefaultValue = "0", IsNullable = true)]
  29. public bool Available { get; set; }
  30. /// <summary>
  31. /// 描述
  32. /// </summary>
  33. [SugarColumn(ColumnDescription = "描述", Length = 500, IsNullable = true)]
  34. public string Description { get; set; }
  35. /// <summary>
  36. /// 商品文案
  37. /// </summary>
  38. [SugarColumn(ColumnDataType ="longtext", ColumnDescription = "商品文案", IsNullable = true)]
  39. public string Content { get; set; }
  40. /// <summary>
  41. /// 总库存
  42. /// </summary>
  43. [SugarColumn(ColumnDescription = "总库存", DefaultValue = "0", IsNullable = true)]
  44. public int TotalStock { get; set; }
  45. /// <summary>
  46. /// 商品规格
  47. /// </summary>
  48. [SqlSugar.SugarColumn(IsIgnore = true)]
  49. public List<TProductSku> Skus { get; set; }
  50. /// <summary>
  51. /// 预览图
  52. /// </summary>
  53. [SqlSugar.SugarColumn(IsIgnore = true)]
  54. public List<string> Images { get {
  55. if (!string.IsNullOrWhiteSpace(Preview))
  56. {
  57. return Preview.Split(',').ToList();
  58. }
  59. return null;
  60. } }
  61. /// <summary>
  62. /// 主图
  63. /// </summary>
  64. [SqlSugar.SugarColumn(IsIgnore = true)]
  65. public string MainImage { get {
  66. if (!string.IsNullOrWhiteSpace(Preview))
  67. {
  68. return Preview.Split(',')[0];
  69. }
  70. return null;
  71. } }
  72. }
  73. public class TProductSeedData : ISeedData<TProduct>
  74. {
  75. public IEnumerable<TProduct> Generate()
  76. =>
  77. [
  78. new TProduct() { Id = 1, Name="小熊软糖", Code="F20250213573548", TotalStock=999, Available = true, Content="<article class=\"s_card article_box\">\r\n <section class=\"section-item\">\r\n <figure class=\"hd_img_box i_bg\">\r\n <img class=\"img_width j_ph\" src=\"//k.sinaimg.cn/n/sinakd20108/320/w960h960/20200801/3c2c-ixeeirz0407000.jpg/w700d1q75cms.jpg\" data-pid=\"\" onload=\"window.STO=window.STO||{};window.STO.fiE=new Date().getTime();\">\r\n <i class=\"ic_zoom faiz_zoom\"></i>\r\n </figure>\r\n <p class=\"hd_img_info\"> <em class=\"hd_img_info_n\"> <strong class=\"hd_img_info_b\">1 </strong>/ 4 </em>HARIBO小熊软糖玩偶~~好可爱~适合爱吃小熊软糖的你们~ ​</p>\r\n </section><section class=\"section-item\">\r\n <figure class=\"hd_img_box i_bg\">\r\n <img class=\"img_width j_ph\" src=\"//k.sinaimg.cn/n/sinakd20108/320/w960h960/20200801/9fb0-ixeeirz0409381.jpg/w700d1q75cms.jpg\" data-pid=\"\" onload=\"window.STO=window.STO||{};window.STO.fiE=new Date().getTime();\">\r\n <i class=\"ic_zoom faiz_zoom\"></i>\r\n </figure>\r\n <p class=\"hd_img_info\"> <em class=\"hd_img_info_n\"> <strong class=\"hd_img_info_b\">2 </strong>/ 4 </em>HARIBO小熊软糖玩偶~~好可爱~适合爱吃小熊软糖的你们~ ​</p>\r\n </section><section class=\"section-item\">\r\n <figure class=\"hd_img_box i_bg\">\r\n <img class=\"img_width j_ph\" src=\"//k.sinaimg.cn/n/sinakd20108/320/w960h960/20200801/de2e-ixeeirz0409397.jpg/w700d1q75cms.jpg\" data-pid=\"\" onload=\"window.STO=window.STO||{};window.STO.fiE=new Date().getTime();\">\r\n <i class=\"ic_zoom faiz_zoom\"></i>\r\n </figure>\r\n <p class=\"hd_img_info\"> <em class=\"hd_img_info_n\"> <strong class=\"hd_img_info_b\">3 </strong>/ 4 </em>HARIBO小熊软糖玩偶~~好可爱~适合爱吃小熊软糖的你们~ ​</p>\r\n </section><section class=\"section-item\">\r\n <figure class=\"hd_img_box i_bg\">\r\n <img class=\"img_width j_ph\" src=\"//k.sinaimg.cn/n/sinakd20108/320/w960h960/20200801/278a-ixeeirz0409411.jpg/w700d1q75cms.jpg\" data-pid=\"\" onload=\"window.STO=window.STO||{};window.STO.fiE=new Date().getTime();\">\r\n <i class=\"ic_zoom faiz_zoom\"></i>\r\n </figure>\r\n <p class=\"hd_img_info\"> <em class=\"hd_img_info_n\"> <strong class=\"hd_img_info_b\">4 </strong>/ 4 </em>HARIBO小熊软糖玩偶~~好可爱~适合爱吃小熊软糖的你们~ ​</p>\r\n </section>\r\n </article>", Description="小熊软糖多种口味新鲜上架", CreateUserId=1, CreateTime = DateTime.Now, Preview = "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png,https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png,https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" },
  79. ];
  80. }