2022-12-08 16:53:47 +08:00
|
|
|
|
using MiniExcelLibs.Attributes;
|
|
|
|
|
|
using Newtonsoft.Json;
|
2021-08-23 16:57:25 +08:00
|
|
|
|
using SqlSugar;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
|
|
namespace ZR.Model.System
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 用户表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[SugarTable("sys_user")]
|
2021-11-27 09:43:04 +08:00
|
|
|
|
[Tenant("0")]
|
2021-08-23 16:57:25 +08:00
|
|
|
|
public class SysUser : SysBase
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 用户id
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
|
|
|
|
|
|
public long UserId { get; set; }
|
2023-05-04 18:20:18 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 登录用户名
|
|
|
|
|
|
/// </summary>
|
2023-05-15 19:52:54 +08:00
|
|
|
|
[SugarColumn(Length = 30, ColumnDescription = "用户账号", ColumnDataType = "varchar")]
|
2021-08-23 16:57:25 +08:00
|
|
|
|
public string UserName { get; set; }
|
2023-05-04 18:20:18 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 用户昵称
|
|
|
|
|
|
/// </summary>
|
2023-05-15 19:52:54 +08:00
|
|
|
|
[SugarColumn(Length = 30, ColumnDescription = "用户昵称", ColumnDataType = "varchar")]
|
2021-08-23 16:57:25 +08:00
|
|
|
|
public string NickName { get; set; }
|
|
|
|
|
|
/// <summary>
|
2023-05-04 18:20:18 +08:00
|
|
|
|
/// 用户类型(00系统用户)
|
2021-08-23 16:57:25 +08:00
|
|
|
|
/// </summary>
|
2023-05-15 19:52:54 +08:00
|
|
|
|
[SugarColumn(Length = 2, ColumnDescription = "用户类型(00系统用户)", ColumnDataType = "varchar", DefaultValue = "00")]
|
|
|
|
|
|
public string UserType { get; set; } = "00";
|
2023-05-04 18:20:18 +08:00
|
|
|
|
//[SugarColumn(IsOnlyIgnoreInsert = true)]
|
2021-08-23 16:57:25 +08:00
|
|
|
|
public string Avatar { get; set; }
|
2023-05-15 19:52:54 +08:00
|
|
|
|
[SugarColumn(Length = 50, ColumnDescription = "用户邮箱", ColumnDataType = "varchar")]
|
2021-08-23 16:57:25 +08:00
|
|
|
|
public string Email { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
2022-12-08 16:53:47 +08:00
|
|
|
|
[ExcelIgnore]
|
2023-05-15 19:52:54 +08:00
|
|
|
|
[SugarColumn(Length = 100, ColumnDescription = "密码", ColumnDataType = "varchar")]
|
2021-08-23 16:57:25 +08:00
|
|
|
|
public string Password { get; set; }
|
2022-02-28 21:37:25 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 手机号
|
|
|
|
|
|
/// </summary>
|
2021-08-23 16:57:25 +08:00
|
|
|
|
public string Phonenumber { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 用户性别(0男 1女 2未知)
|
|
|
|
|
|
/// </summary>
|
2023-05-15 19:52:54 +08:00
|
|
|
|
public int Sex { get; set; }
|
2021-08-23 16:57:25 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 帐号状态(0正常 1停用)
|
|
|
|
|
|
/// </summary>
|
2022-12-08 16:53:47 +08:00
|
|
|
|
[ExcelIgnore]
|
2023-05-15 19:52:54 +08:00
|
|
|
|
public int Status { get; set; }
|
2021-08-23 16:57:25 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 删除标志(0代表存在 2代表删除)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[SugarColumn(IsOnlyIgnoreInsert = true)]
|
2023-05-15 19:52:54 +08:00
|
|
|
|
public int DelFlag { get; set; }
|
2021-08-23 16:57:25 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 最后登录IP
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[SugarColumn(IsOnlyIgnoreInsert = true)]
|
|
|
|
|
|
public string LoginIP { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 最后登录时间
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[SugarColumn(IsOnlyIgnoreInsert = true)]
|
2022-12-08 16:53:47 +08:00
|
|
|
|
[ExcelColumn(Name = "登录日期", Format = "yyyy-MM-dd HH:mm:ss")]
|
2022-12-15 10:59:09 +08:00
|
|
|
|
public DateTime? LoginDate { get; set; }
|
2021-08-23 16:57:25 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 部门Id
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public long DeptId { get; set; }
|
2022-02-28 21:37:25 +08:00
|
|
|
|
|
2021-08-23 16:57:25 +08:00
|
|
|
|
#region 表额外字段
|
|
|
|
|
|
public bool IsAdmin()
|
|
|
|
|
|
{
|
|
|
|
|
|
return IsAdmin(UserId);
|
|
|
|
|
|
}
|
|
|
|
|
|
public static bool IsAdmin(long userId)
|
|
|
|
|
|
{
|
|
|
|
|
|
return 1 == userId;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 拥有角色个数
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
//[SugarColumn(IsIgnore = true)]
|
|
|
|
|
|
//public int RoleNum { get; set; }
|
|
|
|
|
|
[SugarColumn(IsIgnore = true)]
|
|
|
|
|
|
public string DeptName { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 角色id集合
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[SugarColumn(IsIgnore = true)]
|
2022-12-08 16:53:47 +08:00
|
|
|
|
[ExcelIgnore]
|
2022-01-06 12:36:18 +08:00
|
|
|
|
public long[] RoleIds { get; set; }
|
2021-08-23 16:57:25 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 岗位集合
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[SugarColumn(IsIgnore = true)]
|
2022-12-08 16:53:47 +08:00
|
|
|
|
[ExcelIgnore]
|
2021-08-23 16:57:25 +08:00
|
|
|
|
public int[] PostIds { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[SugarColumn(IsIgnore = true)]
|
2022-12-08 16:53:47 +08:00
|
|
|
|
[ExcelIgnore]
|
2021-08-23 16:57:25 +08:00
|
|
|
|
public List<SysRole> Roles { get; set; }
|
2022-02-28 21:37:25 +08:00
|
|
|
|
[SugarColumn(IsIgnore = true)]
|
|
|
|
|
|
public string WelcomeMessage
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
int now = DateTime.Now.Hour;
|
|
|
|
|
|
|
|
|
|
|
|
if (now > 0 && now <= 6)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "午夜好";
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (now > 6 && now <= 11)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "早上好";
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (now > 11 && now <= 14)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "中午好";
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (now > 14 && now <= 18)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "下午好";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return "晚上好";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
[SugarColumn(IsIgnore = true)]
|
|
|
|
|
|
public string WelcomeContent { get; set; }
|
2021-08-23 16:57:25 +08:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|