using SqlSugar;
using System;
namespace Wood.Entity;
///
/// 框架实体基类Id
///
public abstract class EntityIdBase
{
///
/// 雪花Id
/// 如果没有赋值则会自动生成,值为[null,0]时会自动生成
///
[SugarColumn(ColumnDescription = "Id", IsPrimaryKey = true, IsIdentity = false)]
public virtual long Id { get; set; }
}
#region 非租户
///
/// 框架实体基类 创建
///
public abstract class EntityCreateBase : EntityIdBase, ICreateUserIdFilter
{
///
/// 创建者Id
///
[SugarColumn(ColumnDescription = "创建者Id", IsOnlyIgnoreUpdate = true, IsNullable = true)]
public virtual long? CreateUserId { get; set; }
///
/// 创建时间
///
[SugarColumn(ColumnDescription = "创建时间", IsOnlyIgnoreUpdate = true, IsNullable = true)]
public virtual DateTime? CreateTime { get; set; }
}
///
/// 框架实体基类
/// 包括 创建者信息,修改者信息,删除标记
///
public abstract class EntityBase : EntityIdBase, IDeletedFilter, IOrgIdFilter, ICreateUserIdFilter
{
///
/// 创建者部门Id
///
[SugarColumn(ColumnDescription = "创建者部门Id", IsOnlyIgnoreUpdate = true, IsNullable = true)]
public virtual long? CreateOrgId { get; set; }
///
/// 创建时间
///
[SugarColumn(ColumnDescription = "创建时间", IsOnlyIgnoreUpdate = true, IsNullable = true)]
public virtual DateTime? CreateTime { get; set; }
///
/// 创建者Id
///
[SugarColumn(ColumnDescription = "创建者Id", IsOnlyIgnoreUpdate = true, IsNullable = true)]
public virtual long? CreateUserId { get; set; }
///
/// 更新时间
///
[SugarColumn(ColumnDescription = "更新时间", IsOnlyIgnoreInsert = true, IsNullable = true)]
public virtual DateTime? UpdateTime { get; set; }
///
/// 修改者Id
///
[SugarColumn(ColumnDescription = "修改者Id", IsOnlyIgnoreInsert = true, IsNullable = true)]
public virtual long? UpdateUserId { get; set; }
///
/// 软删除
///
[SugarColumn(ColumnDescription = "软删除")]
public virtual bool IsDelete { get; set; } = false;
}
///
/// 框架实体基类
/// 包括 创建者信息,修改者信息,删除标记
/// 额外包括 状态 Status 1有效 0无效
/// 额外包括 备注 Remark
///
public abstract class EntityBaseExtra : EntityBase,IStatusFilter
{
///
/// 状态
/// 1有效 0无效
///
[SugarColumn(ColumnDescription = "状态 1有效 0无效", DefaultValue = "1")]
public int Status { get; set; } = 1;
///
/// 备注
///
[SugarColumn(ColumnDescription = "备注", Length = 128,IsNullable =true)]
public string? Remark { get; set; }
}
#endregion
#region 租户
///
/// 框架实体基类
/// 包括 租户信息,创建者信息,修改者信息,删除标记
///
public abstract class EntityTenantBase : EntityBase, ITenantIdFilter
{
///
/// 租户Id
///
[SugarColumn(ColumnDescription = "租户Id", IsOnlyIgnoreUpdate = true, IsNullable = true,DefaultValue ="0")]
public virtual long TenantId { get; set; } = 0;
}
///
/// 框架实体基类
/// 包括 租户信息,创建者信息,修改者信息,删除标记
/// 额外包括 状态 Status 1有效 0无效
/// 额外包括 备注 Remark
///
public abstract class EntityTenantBaseExtra : EntityBaseExtra, ITenantIdFilter
{
///
/// 租户Id
///
[SugarColumn(ColumnDescription = "租户Id", IsOnlyIgnoreUpdate = true, IsNullable = true, DefaultValue = "0")]
public virtual long TenantId { get; set; } = 0;
}
///
/// 框架实体基类
/// 包括 租户信息,创建者信息
///
public abstract class EntityTenantCreateBase : EntityCreateBase, ITenantIdFilter
{
///
/// 租户Id
///
[SugarColumn(ColumnDescription = "租户Id", IsOnlyIgnoreUpdate = true, IsNullable = true)]
public virtual long TenantId { get; set; }
}
#endregion