using SqlSugar; namespace EasyTemplate.Tool.Entity; /// /// 属性 /// [SugarTable(null, "属性")] [SugarIndex("ParentId", nameof(ParentId), OrderByType.Desc)] public partial class TProductProperty : EntityBaseId, IDeletedFilter { /// /// 属性名称 /// [SugarColumn(ColumnDescription = "属性名称", IsNullable = true)] public string Name { get; set; } /// /// 父级id /// [SugarColumn(ColumnDescription = "父级id", IsNullable = true)] public long ParentId { get; set; } /// /// 软删除,1:删除,0:不删除 /// [SugarColumn(ColumnDescription = "软删除", DefaultValue = "0")] public virtual bool IsDelete { get; set; } = false; /// /// 子集 /// [SqlSugar.SugarColumn(IsIgnore = true)] public List Children { get; set; } } public class TProductPropertySeedData : ISeedData { public IEnumerable Generate() => [ new TProductProperty() { Id = 1, Name="默认", ParentId = 0 }, new TProductProperty() { Id = 2, Name="默认", ParentId = 1 }, new TProductProperty() { Id = 3, Name="颜色", ParentId = 0 }, new TProductProperty() { Id = 4, Name="红色", ParentId = 3 }, new TProductProperty() { Id = 5, Name="绿色", ParentId = 3 }, new TProductProperty() { Id = 6, Name="黄色", ParentId = 3 }, new TProductProperty() { Id = 7, Name="口味", ParentId = 0 }, new TProductProperty() { Id = 8, Name="水果", ParentId = 7 }, new TProductProperty() { Id = 9, Name="可乐", ParentId = 7 }, ]; }