Files
Yi.Admin/Yi.Framework.Net6/Yi.Framework.Model/UserEntity.cs

31 lines
931 B
C#
Raw Normal View History

2022-04-16 00:01:00 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using SqlSugar;
namespace Yi.Framework.Model.Models
{
2022-04-24 16:44:16 +08:00
public partial class UserEntity
2022-04-16 00:01:00 +08:00
{
/// <summary>
/// 看好啦ORM精髓导航属性
///</summary>
[Navigate(typeof(UserRoleEntity), nameof(UserRoleEntity.UserId), nameof(UserRoleEntity.RoleId))]
public List<RoleEntity> Roles { get; set; }
/// <summary>
/// 构建密码MD5盐值加密
/// </summary>
public void BuildPassword(string password = null)
{
//如果不传值那就把自己的password当作传进来的password
if (password == null)
{
password = this.Password;
}
this.Salt = Common.Helper.MD5Helper.GenerateSalt();
this.Password = Common.Helper.MD5Helper.SHA2Encode(password, this.Salt);
}
2022-04-16 00:01:00 +08:00
}
}