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.UserStaff;
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 : EntityBase, ITenant, IData
{
///
/// 拥有者Id
///
[Column(Position = -24)]
public long? OwnerId { get; set; }
///
/// 拥有者部门Id
///
[Column(Position = -23)]
public long? OwnerOrgId { get; set; }
///
/// 租户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 OrgId { get; set; }
///
/// 部门
///
public OrgEntity Org { 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 UserStatus Status { get; set; }
///
/// 用户类型
///
[Column(MapType = typeof(int))]
public UserType Type { get; set; } = UserType.DefaultUser;
///
/// 角色列表
///
[Navigate(ManyToMany = typeof(UserRoleEntity))]
public ICollection Roles { get; set; }
///
/// 部门列表
///
[Navigate(ManyToMany = typeof(UserOrgEntity))]
public ICollection Orgs { get; set; }
///
/// 员工
///
[Navigate(nameof(Id))]
public UserStaffEntity Staff { get; set; }
}