using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace CK.SCP.Models.AppBoxEntity { public class Dept : ICustomTree, IKeyID, ICloneable { [Key] public int ID { get; set; } [Required, StringLength(50)] public string Name { get; set; } [Required] public int SortIndex { get; set; } [StringLength(500)] public string Remark { get; set; } public virtual Dept Parent { get; set; } public virtual ICollection Children { get; set; } public virtual ICollection Users { get; set; } /// /// 菜单在树形结构中的层级(从0开始) /// [NotMapped] public int TreeLevel { get; set; } /// /// 是否可用(默认true),在模拟树的下拉列表中使用 /// [NotMapped] public bool Enabled { get; set; } /// /// 是否叶子节点(默认true) /// [NotMapped] public bool IsTreeLeaf { get; set; } public object Clone() { Dept dept = new Dept { ID = ID, Name = Name, Remark = Remark, SortIndex = SortIndex, TreeLevel = TreeLevel, Enabled = Enabled, IsTreeLeaf = IsTreeLeaf }; return dept; } } }