Permission.cs 1.51 KB
using HHECS.DataContract;
using System.ComponentModel;
using ColumnAttribute = FreeSql.DataAnnotations.ColumnAttribute;
using NotMapped = System.ComponentModel.DataAnnotations.Schema.NotMappedAttribute;

namespace HHECS.RobotTool.Model
{
    /// <summary>
    /// 权限表/菜单表
    /// </summary>
    public class Permission : BaseEntityCU<int>
    {
        public string Code { get; set; } = null!;

        public string Name { get; set; } = null!;

        /// <summary>
        /// 类型
        /// </summary>
        [Column(DbType = "varchar(50)", MapType = typeof(string))]
        public PermissionType PermissionType { get; set; }

        /// <summary>
        /// 父节点
        /// </summary>
        public int? ParentId { get; set; }

        /// <summary>
        /// 页面名称
        /// </summary>
        public string ViewName { get; set; } = null!;

        public string Description { get; set; } = null!;

        public event PropertyChangedEventHandler? PropertyChanged;

        public List<Permission> Children { get; set; } = new List<Permission>();

        [NotMapped]
        public bool CurrentNodeIsChanged { get; set; }
    }

    public enum PermissionType
    {
        /// <summary>
        /// 菜单选项
        /// </summary>
        MenuItem,

        /// <summary>
        /// 按钮
        /// </summary>
        Button,
    }

    public enum ButtonType
    {
        QueryBtn,
        CreateBtn,
        EditBtn,
        DeleteBtn,
        BatchDeleteBtn,
        DetailBtn,
    }
}