You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

175 lines
4.8 KiB
C#

11 months ago
using SqlSugar;
11 months ago
namespace Ds.Modules.DsEntity.Base
{
public abstract class BaseComEntity
{
/// <summary>
/// 备注
/// </summary>
11 months ago
[SqlSugar.SugarColumn(ColumnDescription = "备注")]
public string? DsNote { get; set; } = "0qaqq";
11 months ago
/// <summary>
/// 创建时间
/// </summary>
11 months ago
[SqlSugar.SugarColumn(ColumnDescription = "创建时间")]
public DateTime DsAddTime { get; set; } = DateTime.Now;
11 months ago
/// <summary>
/// 创建人
/// </summary>
11 months ago
[SqlSugar.SugarColumn(ColumnDescription = "创建人")]
public string? DsAddUserInfo { get; set; } = "admin";
11 months ago
/// <summary>
/// 修改人
/// </summary>
11 months ago
[SqlSugar.SugarColumn(ColumnDescription = "修改人")]
public string? DsUpdateUserInfo { get; set; } = "admin";
11 months ago
/// <summary>
/// 更新时间
/// </summary>
11 months ago
[SqlSugar.SugarColumn(ColumnDescription = "更新时间")]
public DateTime DsUpdateTime { get; set; } = DateTime.Now;
11 months ago
/// <summary>
/// 删除
/// </summary>
11 months ago
11 months ago
[SqlSugar.SugarColumn(ColumnDescription = "是否删除")]
11 months ago
public bool DsIsDel { get; set; } = false;
11 months ago
/// <summary>
/// 删除时间
/// </summary>
11 months ago
11 months ago
[SqlSugar.SugarColumn(ColumnDescription = "删除时间")]
11 months ago
public DateTime DsDeleteTime { get; set; } = DateTime.Now;
11 months ago
/// <summary>
/// 删除人
/// </summary>
11 months ago
[SqlSugar.SugarColumn(ColumnDescription = "删除人")]
public string? DsDeleteUserInfo { get; set; } = "admin";
11 months ago
/// <summary>
/// 排序
/// </summary>
11 months ago
[SqlSugar.SugarColumn(ColumnDescription = "排序")]
public int DsSort { get; set; } = 0;
11 months ago
}
/// <summary>
/// 实体类基类无租户
/// </summary>
public abstract class BasEntity<TKey> : BaseComEntity
{
/// <summary>
/// 主键ID
/// </summary>
[Description("主键ID")]
[SugarColumn(IsPrimaryKey = true, Length = 100, ColumnDescription = "主键ID")]
public TKey Id { get; set; }
}
/// <summary>
/// 实体基类雪花无租户
/// </summary>
public abstract class BasEntityNoTenant : BaseComEntity
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
}
public abstract class BasEntityTenantForIsIdentity : BaseComEntity
{
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]//数据库是自增才配自增
public long Id { get; set; }
/// <summary>
/// 租户编号
/// </summary>
public string TenantNumber { get; set; } = "123";
}
11 months ago
/// <summary>
/// 租户雪花ID实体基类
/// </summary>
public abstract class BaseEntityTenant : BaseComEntity
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; } = 111111111111111;
11 months ago
/// <summary>
/// 租户编号
/// </summary>
public string TenantNumber { get; set; } = "123";
11 months ago
}
/// <summary>
/// 租户实体基类key类型
/// </summary>
/// <typeparam name="Tkey"></typeparam>
public abstract class BaseEntityKey<Tkey> : BaseComEntity
{
/// <summary>
/// 主键ID
/// </summary>
[Description("主键ID")]
[SugarColumn(IsPrimaryKey = true, Length = 100, ColumnDescription = "主键ID")]
public Tkey Id { get; set; }
/// <summary>
/// 租户编号
/// </summary>
11 months ago
public string TenantNumber { get; set; }
11 months ago
}
/// <summary>
/// 租户实体基类key类型
/// </summary>
/// <typeparam name="Tkey"></typeparam>
public abstract class BaseEntityNoTenantKey<Tkey> : BaseComEntity
{
/// <summary>
/// 主键ID
/// </summary>
[Description("主键ID")]
[SugarColumn(IsPrimaryKey = true, Length = 100, ColumnDescription = "主键ID")]
public Tkey Id { get; set; }
}
/// <summary>
/// 租户实体基类key类型
/// </summary>
/// <typeparam name="Tkey"></typeparam>
public abstract class BaseEntityGuid : BaseComEntity
{
11 months ago
public BaseEntityGuid()
{
var worker = new Snowflake.Core.IdWorker(1, 1);
Id = worker.NextId();
}
11 months ago
/// <summary>
/// 主键ID
/// </summary>
[Description("主键ID")]
11 months ago
[SqlSugar.SugarColumn(IsPrimaryKey = true, Length = 100, ColumnDescription = "主键ID")]
public long Id { get; set; }
11 months ago
/// <summary>
/// 租户编号
/// </summary>
11 months ago
[SqlSugar.SugarColumn(ColumnDescription = "租户编号")]
public long TenantNumber { get; set; }
11 months ago
}
}