using SqlSugar;
using Volo.Abp.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace FoodLabeling.Th.Domain.Entities;
///
/// 平台主库:租户默认管理员可回显凭据(AES 密文,非登录哈希)
///
///
/// 主键列名为 TenantId;仓储泛型键仍用 Guid(映射到 Id)。
/// 勿再对 Id 使用 IsIgnore 别名,否则 SqlSugar Insertable 会 NRE。
///
[SugarTable("fl_th_tenant_admin_credential")]
[DefaultTenantTable]
public class ThTenantAdminCredentialEntity : Entity
{
///
/// 租户 Id(主键,对应 YiTenant.Id;列名 TenantId)
///
[SugarColumn(IsPrimaryKey = true, ColumnName = "TenantId")]
public override Guid Id { get; protected set; }
///
/// 管理员登录账号(UserName)
///
[SugarColumn(Length = 64)]
public string LoginAccount { get; set; } = string.Empty;
///
/// AES-CBC 加密后的可回显密码(Base64 密文)
///
[SugarColumn(Length = 512)]
public string PasswordCipher { get; set; } = string.Empty;
///
/// AES IV(Base64)
///
[SugarColumn(Length = 64)]
public string PasswordIv { get; set; } = string.Empty;
///
/// 最后修改时间
///
public DateTime? LastModificationTime { get; set; }
public void SetTenantId(Guid tenantId) => Id = tenantId;
}