using SqlSugar; namespace EasyTemplate.Tool.Entity; /// /// 商品 /// [SugarTable(null, "商品")] [SugarIndex("CreateTime", nameof(CreateTime), OrderByType.Desc)] public partial class TProduct: EntityBase { /// /// 商品名称 /// [SugarColumn(ColumnDescription = "商品名称", IsNullable = true)] public string Name { get; set; } /// /// 总库存 /// [SugarColumn(ColumnDescription = "商品编码", IsNullable = true)] public string Code { get; set; } /// /// 预览图 /// [SugarColumn(ColumnDataType = "text", ColumnDescription = "预览图", IsNullable = true)] public string Preview { get; set; } /// /// 是否可用 /// [SugarColumn(ColumnDescription = "是否可用", DefaultValue = "0", IsNullable = true)] public bool Available { get; set; } /// /// 描述 /// [SugarColumn(ColumnDescription = "描述", Length = 500, IsNullable = true)] public string Description { get; set; } /// /// 商品文案 /// [SugarColumn(ColumnDataType ="longtext", ColumnDescription = "商品文案", IsNullable = true)] public string Content { get; set; } /// /// 总库存 /// [SugarColumn(ColumnDescription = "总库存", DefaultValue = "0", IsNullable = true)] public int TotalStock { get; set; } /// /// 商品规格 /// [SqlSugar.SugarColumn(IsIgnore = true)] public List Skus { get; set; } /// /// 预览图 /// [SqlSugar.SugarColumn(IsIgnore = true)] public List Images { get { if (!string.IsNullOrWhiteSpace(Preview)) { return Preview.Split(',').ToList(); } return null; } } /// /// 主图 /// [SqlSugar.SugarColumn(IsIgnore = true)] public string MainImage { get { if (!string.IsNullOrWhiteSpace(Preview)) { return Preview.Split(',')[0]; } return null; } } } public class TProductSeedData : ISeedData { public IEnumerable Generate() => [ new TProduct() { Id = 1, Name="小熊软糖", Code="F20250213573548", TotalStock=999, Available = true, Content="
\r\n
\r\n
\r\n \r\n \r\n
\r\n

1 / 4 HARIBO小熊软糖玩偶~~好可爱~适合爱吃小熊软糖的你们~ ​

\r\n
\r\n
\r\n \r\n \r\n
\r\n

2 / 4 HARIBO小熊软糖玩偶~~好可爱~适合爱吃小熊软糖的你们~ ​

\r\n
\r\n
\r\n \r\n \r\n
\r\n

3 / 4 HARIBO小熊软糖玩偶~~好可爱~适合爱吃小熊软糖的你们~ ​

\r\n
\r\n
\r\n \r\n \r\n
\r\n

4 / 4 HARIBO小熊软糖玩偶~~好可爱~适合爱吃小熊软糖的你们~ ​

\r\n
\r\n
", 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" }, ]; }