| | |
| | | /// <summary> |
| | | /// 部门 |
| | | /// </summary> |
| | | public class Department : CommonEntity, IEntityTypeBuilder<Department> |
| | | public class Department : CommonEntity, IEntityTypeBuilder<Department>, IIsDisabled |
| | | { |
| | | public Department() |
| | | { |
| | | Childrens = []; |
| | | Children = []; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// 下级 |
| | | /// </summary> |
| | | public List<Department> Childrens { get; set; } |
| | | public List<Department> Children { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 部门路径 |
| | | /// </summary> |
| | | public string Path { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 企业Id |
| | |
| | | public void Configure(EntityTypeBuilder<Department> entityBuilder, DbContext dbContext, Type dbContextLocator) |
| | | { |
| | | entityBuilder |
| | | .HasMany(x => x.Childrens) |
| | | .HasMany(x => x.Children) |
| | | .WithOne(x => x.Parent) |
| | | .HasForeignKey(x => x.ParentId) |
| | | .OnDelete(DeleteBehavior.ClientSetNull); |