提交代码

This commit is contained in:
hehaibing-1996
2024-05-03 11:04:59 +08:00
parent 97888c6978
commit d283924ae1
48 changed files with 802 additions and 509 deletions

View File

@ -0,0 +1,83 @@
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("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>
/// 角色idjson
/// </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>
public DateTime Time { get; set; }
/// <summary>
/// 用户所属角色
/// </summary>
[SugarColumn(IsIgnore = true)]
public List<RoleBase> GetRoles { get; set; }
}
/// <summary>
/// 角色
/// </summary>
[SugarTable("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>
[SugarColumn(IsIgnore = true)]
public List<string> AuthNames { get => Auths == null || !Auths.Any() ? new List<string>() : EnumHelps.GetEnumDescriptionList(typeof(AuthEnum), true).Where(o => Auths.Contains(o.Item1)).Select(o => o.Item3).ToList(); }
/// <summary>
/// 是否最大权限
/// </summary>
public bool IsAdmin { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime Time { get; set; }
}
}