using System.ComponentModel.DataAnnotations;
using AntDesign;
using SqlSugar;
using static EasyTemplate.Tool.Entity.PublicEnum;
namespace EasyTemplate.Tool.Entity;
///
/// 系统用户
///
[SugarTable(null, "系统用户")]
public class SystemUser: EntityBase
{
///
/// 账号
///
[SugarColumn(ColumnDescription = "账号", Length = 32, IsNullable = true)]
public string Account { get; set; }
///
/// 密码
///
[SugarColumn(ColumnDescription = "密码", Length = 32, IsNullable = true)]
public string Password { get; set; }
///
/// 昵称
///
[SugarColumn(ColumnDescription = "昵称", Length = 32, IsNullable = true)]
public string NickName { get; set; }
///
/// 头像
///
[SugarColumn(ColumnDescription = "头像", DefaultValue = "/assets/default_avatar.png", IsNullable = true)]
public string Avatar { get; set; }
///
/// 手机
///
[SugarColumn(ColumnDescription = "手机", IsNullable = true)]
public string Mobile { get; set; }
///
/// 邮箱
///
[SugarColumn(ColumnDescription = "邮箱", IsNullable = true)]
public string Email { get; set; }
///
/// 地区id
///
[SugarColumn(ColumnDescription = "地区id", IsNullable = true)]
public string AreaIds { get; set; }
///
/// 地址
///
[SugarColumn(ColumnDescription = "地址", IsNullable = true)]
public string Address { get; set; }
///
/// 签名
///
[SugarColumn(ColumnDescription = "签名", IsNullable = true)]
public string Signature { get; set; }
///
/// 角色id
///
[SugarColumn(ColumnDescription = "角色id", IsNullable = true)]
public long RoleId { get; set; }
///
/// 部门id
///
[SugarColumn(ColumnDescription = "部门id", IsNullable = true)]
public long DepartmentId { get; set; }
///
/// 是否启用
///
[SugarColumn(ColumnDescription = "是否启用", DefaultValue ="1", IsNullable = true)]
public bool Enabled { get; set; }
///
/// 绑定谷歌账号
///
[SugarColumn(ColumnDescription = "绑定谷歌账号", IsNullable = true)]
public string BindingGoogle { get; set; }
///
/// 绑定X账号
///
[SugarColumn(ColumnDescription = "绑定X账号", IsNullable = true)]
public string BindingX { get; set; }
///
/// 绑定Facebook账号
///
[SugarColumn(ColumnDescription = "绑定Facebook账号", IsNullable = true)]
public string BindingFacebook { get; set; }
///
/// 过期时间
///
[SugarColumn(IsIgnore = true)]
public DateTime Expired { get; set; }
///
/// 确认密码
///
[SugarColumn(IsIgnore = true)]
public string ConfirmPassword { get; set; }
///
/// 角色名称
///
[SugarColumn(IsIgnore = true)]
public string RoleName { get; set; }
///
/// 部门名称
///
[SugarColumn(IsIgnore = true)]
public string DepartmentName { get; set; }
///
/// 最后一个区域id,用于级联回显
///
[SugarColumn(IsIgnore = true)]
public string LastAreadId { get; set; }
///
/// 地区全拼
///
[SugarColumn(IsIgnore = true)]
public string Area { get; set; }
}
public class SystemUserSeedData : ISeedData
{
public IEnumerable Generate()
=>
[
new SystemUser() { Id = 1, Account = "admin", Password = "e10adc3949ba59abbe56e057f20f883e", Enabled=true, Avatar="/assets/default_avatar.png", NickName="超级管理员", Mobile="13789756548", AreaIds="37,82,85", Email="asdfkuhuasd@163.com", RoleId=1, DepartmentId=1, CreateTime = DateTime.Now },
new SystemUser() { Id = 2, Account = "david111", Password = "e10adc3949ba59abbe56e057f20f883e", Enabled=true, Avatar="/assets/default_avatar.png", NickName="用户1", Mobile="15364878984", Email="12312323@sina.com", RoleId=2, DepartmentId=1,CreateTime = DateTime.Now },
];
}
public class LoginInput
{
[Required] public string Account { get; set; }
[Required] public string Password { get; set; }
public string Mobile { get; set; }
public string Captcha { get; set; }
public string VerifyCode { get; set; }
public string LoginType { get; set; }
public bool AutoLogin { get; set; }
}