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