using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using ZhonTai.Admin.Core.Entities;
using ZhonTai.Admin.Domain.Tenant;
using ZhonTai.Admin.Domain.Role;
using ZhonTai.Admin.Domain.UserRole;
using ZhonTai.Admin.Domain.Staff;
using ZhonTai.Admin.Domain.Org;
namespace ZhonTai.Admin.Domain.User;
///
/// 用户
///
[Table(Name = "ad_user")]
[Index("idx_{tablename}_01", nameof(UserName) + "," + nameof(TenantId), true)]
public partial class UserEntity : EntityFull, ITenant
{
///
/// 租户Id
///
[Column(Position = 2)]
public long? TenantId { get; set; }
public TenantEntity Tenant { get; set; }
///
/// 账号
///
[Column(StringLength = 60)]
public string UserName { get; set; }
///
/// 密码
///
[Column(StringLength = 60)]
public string Password { get; set; }
///
/// 姓名
///
[Column(StringLength = 20)]
public string Name { get; set; }
///
/// 手机号
///
[Column(StringLength = 20)]
public string Mobile { get; set; }
///
/// 邮箱
///
[Column(StringLength = 100)]
public string Email { get; set; }
///
/// 主属部门Id
///
public long MainOrgId { get; set; }
public OrgEntity MainOrg { get; set; }
///
/// 直属主管Id
///
public long? ManagerUserId { get; set; }
public UserEntity ManagerUser { get; set; }
///
/// 昵称
///
[Column(StringLength = 20)]
public string NickName { get; set; }
///
/// 头像
///
[Column(StringLength = 100)]
public string Avatar { get; set; }
///
/// 用户状态
///
[Column(MapType = typeof(int))]
public UserStatusEnum Status { get; set; }
///
/// 用户类型
///
[Column(MapType = typeof(int))]
public UserTypeEnum Type { get; set; } = UserTypeEnum.User;
///
/// 角色列表
///
[Navigate(ManyToMany = typeof(UserRoleEntity))]
public ICollection Roles { get; set; }
[Navigate(ManyToMany = typeof(UserOrgEntity))]
public ICollection Orgs { get; set; }
///
/// 员工
///
[Navigate(nameof(Id))]
public StaffEntity Staff { get; set; }
}