LMS.service/LMS.Repository/DB/Permission.cs
2024-10-13 17:04:47 +08:00

83 lines
2.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using LMS.Common.Enums;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json;
using static LMS.Common.Enums.PermissionEnum;
namespace LMS.Repository.Models.DB
{
/// <summary>
/// 所有的权限集合
/// </summary>
public class Permission
{
/// <summary>
/// 权限的ID
/// </summary>
public string Id { get; set; }
/// <summary>
/// 用户的ID
/// </summary>
public long? UserId { get; set; }
/// <summary>
/// 机器码的ID是ID不是机器码
/// </summary>
public string? MachineId { get; set; }
/// <summary>
/// 角色ID
/// </summary>
public long? RoleId { get; set; }
/// <summary>
/// 权限类型的ID子权限
/// </summary>
[Column(TypeName = "json")]
public string PermissionTypeIds { get; set; }
/// <summary>
/// 权限对应的Code
/// </summary>
public string PermissionCode { get; set; }
/// <summary>
/// 权限类型
/// </summary>
public PType Type { get; set; }
/// <summary>
/// 创建人ID
/// </summary>
public long CreateUserId { get; set; }
/// <summary>
/// 更新人ID
/// </summary>
public long UpdateUserId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime UpdateTime { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
[NotMapped]
public List<string> PermissionTypeIdsJson
{
get => JsonSerializer.Deserialize<List<string>>(PermissionTypeIds) ?? [];
set => PermissionTypeIds = JsonSerializer.Serialize(value);
}
}
}