using Furion.DatabaseAccessor;
using Furion.JsonSerialization;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace YBEE.EQM.Core;
///
/// 用户
///
[Comment("用户")]
public partial class SysUser : DEntityBase, IEntityTypeBuilder
{
///
/// 机构ID
///
[Comment("机构ID")]
[Required]
public short SysOrgId { get; set; }
///
/// 名称
///
[Comment("名称")]
[Required, StringLength(200)]
public string Name { get; set; }
///
/// 头像地址
///
[Comment("头像地址")]
[StringLength(500)]
public string Avatar { get; set; }
///
/// 手机
///
[Comment("手机")]
[StringLength(16)]
public string Mobile { get; set; }
///
/// 电子邮箱
///
[Comment("电子邮箱")]
[StringLength(200)]
public string Email { get; set; }
///
/// 工号
///
[Comment("工号")]
[StringLength(200)]
public string JobNumber { get; set; }
///
/// 备注
///
[Comment("备注")]
[StringLength(200)]
public string Remark { get; set; }
///
/// 登录名
///
[Comment("登录名")]
[Required, StringLength(50)]
public string Account { get; set; }
///
/// 密码
///
[Comment("密码")]
[Required, StringLength(100)]
public string Password { get; set; }
///
/// 是否已激活
///
[Comment("是否已激活")]
[Required]
public bool IsActivated { get; set; } = false;
///
/// 激活时间
///
[Comment("激活时间")]
public DateTime? ActivateTime { get; set; }
///
/// 最后登录IP
///
[Comment("最后登录IP")]
[MaxLength(21)]
public string LastLoginIp { get; set; }
///
/// 最后登录时间
///
[Comment("最后登录时间")]
public DateTime? LastLoginTime { get; set; }
///
/// 用户自定义配置
///
[Comment("用户自定义配置")]
[Column(TypeName = "json")]
public string Config { get; set; } = "{}";
///
/// 用户权限
///
[Comment("用户权限")]
[Column(TypeName = "json")]
public string Permission { get; set; } = JSON.Serialize(new UserPermission());
///
/// 状态
///
[Comment("状态")]
[Required]
public CommonStatus Status { get; set; }
///
/// 一对一引用(机构)
///
public virtual SysOrg SysOrg { get; set; }
public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.Ignore(t => t.CreateSysUser).Ignore(t => t.UpdateSysUser);
}
}