using ZhonTai.Admin.Core.Entities;
using FreeSql.DataAnnotations;
using System.Collections.Generic;
using ZhonTai.Admin.Domain.UserStaff;
using ZhonTai.Admin.Domain.User;
using ZhonTai.Admin.Domain.Role;
using ZhonTai.Admin.Domain.UserOrg;
namespace ZhonTai.Admin.Domain.Org;
///
/// 组织架构
///
[Table(Name = "ad_org")]
[Index("idx_{tablename}_01", nameof(ParentId) + "," + nameof(Name) + "," + nameof(TenantId), true)]
public partial class OrgEntity : EntityBase, ITenant
{
///
/// 租户Id
///
[Column(Position = -10, CanUpdate = false)]
public long? TenantId { get; set; }
///
/// 父级
///
public long ParentId { get; set; }
///
/// 名称
///
[Column(StringLength = 50)]
public string Name { get; set; }
///
/// 编码
///
[Column(StringLength = 50)]
public string Code { get; set; }
///
/// 值
///
[Column(StringLength = 50)]
public string Value { get; set; }
///
/// 成员数
///
public int MemberCount { get; set; }
///
/// 描述
///
[Column(StringLength = 500)]
public string Description { get; set; }
///
/// 启用
///
public bool Enabled { get; set; } = true;
///
/// 排序
///
public int Sort { get; set; }
///
/// 员工列表
///
[Navigate(ManyToMany = typeof(UserOrgEntity))]
public ICollection Staffs { get; set; }
///
/// 用户列表
///
[Navigate(ManyToMany = typeof(UserOrgEntity))]
public ICollection Users { get; set; }
///
/// 角色列表
///
[Navigate(ManyToMany = typeof(RoleOrgEntity))]
public ICollection Roles { get; set; }
///
/// 子级列表
///
[Navigate(nameof(ParentId))]
public List Childs { get; set; }
}