using Abp; using Abp.Domain.Entities.Auditing; using Abp.Domain.Entities; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DataTransmission.Entity { public class Entity { //private List _domainEvents = new(); public string Id { get; set; } //[SugarColumn(ColumnDescription = "创建人")] public string? CreatorId { get; set; } public string? CreatorName { get; set; } //[SugarColumn(ColumnDescription = "组织Id")] public string? CreatorOrgId { get; set; } public string? CreatorOrgName { get; set; } //[SugarColumn(DefaultValue = "0")] public int CreatorOrgLevel { get; set; } = 0; /// /// 一级部门Id /// //[SugarColumn(ColumnDescription = "数据权限区域Id")] public string? AreaId { get; set; } //public void ClearEvents() => _domainEvents.Clear(); //public ICollection QueryAllEvents() => _domainEvents; public void InitId() => Id = SequentialGuidGenerator.Instance.Create().ToString("D"); } /// /// 实体(带有创建时间) /// public abstract class CreationEntity : Entity, IHasCreationTime { /// /// 创建时间 /// //[SugarColumn(ColumnDescription = "创建时间")] public DateTime CreationTime { get; set; } } /// /// 实体(带有软删除) /// public abstract class SoftDeleteEntity : Entity, IHasDeletionTime, ISoftDelete { /// /// 删除时间 /// //[SugarColumn(ColumnDescription = "删除时间")] public DateTime? DeletionTime { get; set; } //[SugarColumn(ColumnDescription = "是否删除")] public bool IsDeleted { get; set; } public void SoftDelete() { IsDeleted = true; DeletionTime = DateTime.Now; } } /// /// 实体(带有创建时间和软删除) /// public abstract class CreationSoftDeleteEntity : CreationEntity, IHasDeletionTime, ISoftDelete { //[SugarColumn(ColumnDescription = "是否删除", DefaultValue = "f")] public bool IsDeleted { get; set; } /// /// 删除时间 /// //[SugarColumn(ColumnDescription = "删除时间")] public DateTime? DeletionTime { get; set; } public void SoftDelete() { IsDeleted = true; DeletionTime = DateTime.Now; } public void Recover() => IsDeleted = false; } public abstract class CreationModificationEntity : CreationEntity, IHasModificationTime { /// /// 最近更新时间 /// //[SugarColumn(ColumnDescription = "最近更新时间")] public DateTime? LastModificationTime { get; set; } public void Modified() => LastModificationTime = DateTime.Now; } /// /// 全状态实体(创建时间、更新时间、软删除) /// public abstract class FullStateEntity : CreationSoftDeleteEntity, IHasModificationTime { /// /// 最近更新时间 /// //[SugarColumn(ColumnDescription = "最近更新时间")] public DateTime? LastModificationTime { get; set; } public void Modified() => LastModificationTime = DateTime.Now; } public abstract class WorkflowEntity : FullStateEntity, IWorkflow { //[SugarColumn(IsNullable = true)] public string? WorkflowId { get; set; } /// /// 过期时间配置id /// //[SugarColumn(IsNullable = true)] public string? ExpiredTimeConfigId { get; set; } //[SugarColumn(ColumnDataType = "json", IsJson = true)] public List? FlowedOrgIds { get; set; } = new(); //[SugarColumn(ColumnDataType = "json", IsJson = true)] public List? FlowedUserIds { get; set; } = new(); #region 当前办理对象 /// /// 办理人id /// //[SugarColumn(ColumnDataType = "json", IsJson = true)] public List? HandlerUsers { get; set; } = new(); /// /// 办理部门id /// //[SugarColumn(ColumnDataType = "json", IsJson = true)] public List? HandlerOrgs { get; set; } = new(); #endregion } public abstract class PositionEntity : FullStateEntity { /// /// 经度 /// //[SugarColumn(ColumnDescription = "经度")] public double? Longitude { get; set; } /// /// 维度 /// //[SugarColumn(ColumnDescription = "纬度")] public double? Latitude { get; set; } /// /// 行政区划编码 /// //[SugarColumn(ColumnDescription = "行政区划编码")] public string? AreaCode { get; set; } /// /// 省 /// public string? Province { get; set; } /// /// 市 /// public string? City { get; set; } /// /// 区/县 /// public string? County { get; set; } /// /// 乡镇(4级行政区划) /// public string? Town { get; set; } /// /// 详细街道 /// public string? Street { get; set; } /// /// 行政区划地址 /// public string? Address { get; set; } /// /// 完整地址 /// public string? FullAddress { get; set; } } public abstract class PositionWorkflowEntity : PositionEntity, IWorkflow { //[SugarColumn(IsNullable = true)] public string? WorkflowId { get; set; } /// /// 过期时间配置id /// //[SugarColumn(IsNullable = true)] public string? ExpiredTimeConfigId { get; set; } //[SugarColumn(ColumnDataType = "json", IsJson = true)] public List? FlowedOrgIds { get; set; } = new(); //[SugarColumn(ColumnDataType = "json", IsJson = true)] public List? FlowedUserIds { get; set; } = new(); #region 当前办理对象 /// /// 办理人id /// //[SugarColumn(ColumnDataType = "json", IsJson = true)] public List? HandlerUsers { get; set; } = new(); /// /// 办理部门id /// //[SugarColumn(ColumnDataType = "json", IsJson = true)] public List? HandlerOrgs { get; set; } = new(); #endregion } }