优化代码

This commit is contained in:
不做码农
2021-12-26 18:26:38 +08:00
parent 72b6fba559
commit b27ea85fed
9 changed files with 179 additions and 77 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ZR.Model.System
@@ -10,6 +11,7 @@ namespace ZR.Model.System
public class LoginUser
{
public long UserId { get; set; }
public long DeptId { get; set; }
public string UserName { get; set; }
public string NickName { get; set; }
/// <summary>
@@ -17,18 +19,17 @@ namespace ZR.Model.System
/// </summary>
public List<string> RoleIds { get; set; }
/// <summary>
/// 角色集合
/// </summary>
public List<SysRole> Roles { get; set; }
/// <summary>
/// 权限集合
/// </summary>
public List<string> Permissions{ get; set; }
public List<string> Permissions { get; set; }
public LoginUser()
{
}
public LoginUser(long userId, string userName)
{
UserId = userId;
UserName = userName;
}
public LoginUser(long userId, string userName, List<string> roleIds, List<string> permissions)
{
UserId = userId;
@@ -36,5 +37,14 @@ namespace ZR.Model.System
RoleIds = roleIds;
Permissions = permissions;
}
public LoginUser(SysUser user, List<SysRole> roles, List<string> permissions)
{
UserId = user.UserId;
UserName = user.UserName;
DeptId = user.DeptId;
Roles = roles;
RoleIds = roles.Select(f => f.RoleKey).ToList();
Permissions = permissions;
}
}
}