90 lines
2.6 KiB
C#
90 lines
2.6 KiB
C#
using SqlSugar;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Text;
|
||
using WCS.DAL.Db;
|
||
using WCS.Model;
|
||
|
||
namespace WCS.DAL.Db.AuthDb
|
||
{
|
||
/// <summary>
|
||
/// 用户
|
||
/// </summary>
|
||
[SugarTable("wcs_user")]
|
||
public class UserBase
|
||
{
|
||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||
public int Id { get; set; }
|
||
/// <summary>
|
||
/// 登录名
|
||
/// </summary>
|
||
public string LoginName { get; set; }
|
||
/// <summary>
|
||
/// 密码
|
||
/// </summary>
|
||
public string Password { get; set; }
|
||
/// <summary>
|
||
/// 角色id(json)
|
||
/// </summary>
|
||
[SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString, IsJson = true)]
|
||
public List<int> RoleIds { get; set; } = new List<int>();
|
||
/// <summary>
|
||
/// 角色名称
|
||
/// </summary>
|
||
[SugarColumn(IsIgnore = true)]
|
||
public List<string> RoleNames { get => RoleIds == null || !RoleIds.Any() ? new List<string>() : AuthDbHelp.db.Queryable<RoleBase>().Where(o => RoleIds.Contains(o.Id)).Select(o => o.Name).ToList(); }
|
||
/// <summary>
|
||
/// 是否最大权限
|
||
/// </summary>
|
||
public bool IsAdmin { get; set; }
|
||
|
||
///// <summary>
|
||
///// 是否是工程研发
|
||
///// </summary>
|
||
//[SugarColumn(ColumnName = "IsGCYF", IsNullable = true, ColumnDescription = "是否是工程研发人员")]
|
||
public bool IsGCYF { get; set; } = false;
|
||
|
||
/// <summary>
|
||
/// 创建时间
|
||
/// </summary>
|
||
public DateTime Time { get; set; }
|
||
|
||
/// <summary>
|
||
/// 用户所属角色
|
||
/// </summary>
|
||
[SugarColumn(IsIgnore = true)]
|
||
public List<RoleBase> GetRoles { get; set; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 角色
|
||
/// </summary>
|
||
[SugarTable("wcs_role")]
|
||
public class RoleBase
|
||
{
|
||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||
public int Id { get; set; }
|
||
/// <summary>
|
||
/// 角色名
|
||
/// </summary>
|
||
public string Name { get; set; }
|
||
/// <summary>
|
||
/// 认证模块(json)
|
||
/// </summary>
|
||
[SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString, IsJson = true)]
|
||
public List<int> Auths { get; set; } = new List<int>();
|
||
/// <summary>
|
||
/// 认证模块名称
|
||
/// </summary>
|
||
public string AuthNames { get; set; }
|
||
/// <summary>
|
||
/// 是否最大权限
|
||
/// </summary>
|
||
public bool IsAdmin { get; set; }
|
||
/// <summary>
|
||
/// 创建时间
|
||
/// </summary>
|
||
public DateTime Time { get; set; }
|
||
}
|
||
}
|