// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using System.Text.Json;
namespace Admin.NET.Core;
///
/// 系统机构表
///
[SugarTable(null, "系统机构表")]
[SysTable]
[SugarIndex("index_{table}_N", nameof(Name), OrderByType.Asc)]
[SugarIndex("index_{table}_C", nameof(Code), OrderByType.Asc)]
[SugarIndex("index_{table}_T", nameof(Type), OrderByType.Asc)]
public class SysOrg : EntityTenant
{
///
/// 父Id
///
[SugarColumn(ColumnDescription = "父Id")]
public long Pid { get; set; }
///
/// 名称
///
[SugarColumn(ColumnDescription = "名称", Length = 64)]
[Required, MaxLength(64)]
public virtual string Name { get; set; }
///
/// 编码
///
[SugarColumn(ColumnDescription = "编码", Length = 64)]
[MaxLength(64)]
public string? Code { get; set; }
///
/// 级别
///
[SugarColumn(ColumnDescription = "级别")]
public int? Level { get; set; }
///
/// 机构类型-数据字典
///
[SugarColumn(ColumnDescription = "机构类型", Length = 64)]
[MaxLength(64)]
public string? Type { get; set; }
///
/// 负责人Id
///
[SugarColumn(ColumnDescription = "负责人Id", IsNullable = true)]
public long? DirectorId { get; set; }
///
/// 负责人
///
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
[Navigate(NavigateType.OneToOne, nameof(DirectorId))]
public SysUser Director { get; set; }
///
/// 排序
///
[SugarColumn(ColumnDescription = "排序")]
public int OrderNo { get; set; } = 100;
///
/// 状态
///
[SugarColumn(ColumnDescription = "状态")]
public StatusEnum Status { get; set; } = StatusEnum.Enable;
///
/// 备注
///
[SugarColumn(ColumnDescription = "备注", Length = 128)]
[MaxLength(128)]
public string? Remark { get; set; }
///
/// 机构子项
///
[SugarColumn(IsIgnore = true)]
public List Children { get; set; }
///
/// 是否禁止选中
///
[SugarColumn(IsIgnore = true)]
public bool Disabled { get; set; }
[SugarColumn(IsNullable = true, ColumnDataType = "TEXT")]
public string? Position { get; set; }
[SugarColumn(ColumnDataType = "json")] public string ServiceIdsJson { get; set; }
[SugarColumn(IsIgnore = true)] public List? Services { get; set; }
[SugarColumn(IsIgnore = true)]
public List? ServiceIds
{
get
{
if (string.IsNullOrWhiteSpace(ServiceIdsJson))
return null;
return JsonSerializer.Deserialize>(ServiceIdsJson);
}
set { ServiceIdsJson = JsonSerializer.Serialize(value); }
}
}