113 lines
2.5 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 System.ComponentModel.DataAnnotations;
namespace AmtScanner.Api.Models;
/// <summary>
/// 系统菜单
/// </summary>
public class Menu
{
[Key]
public int Id { get; set; }
/// <summary>
/// 父菜单 IDnull 表示顶级菜单)
/// </summary>
public int? ParentId { get; set; }
/// <summary>
/// 路由名称
/// </summary>
[Required]
[MaxLength(100)]
public string Name { get; set; } = string.Empty;
/// <summary>
/// 路由路径
/// </summary>
[Required]
[MaxLength(200)]
public string Path { get; set; } = string.Empty;
/// <summary>
/// 组件路径
/// </summary>
[MaxLength(200)]
public string? Component { get; set; }
/// <summary>
/// 菜单标题i18n key 或直接文本)
/// </summary>
[MaxLength(200)]
public string? Title { get; set; }
/// <summary>
/// 图标
/// </summary>
[MaxLength(100)]
public string? Icon { get; set; }
/// <summary>
/// 排序(数字越小越靠前)
/// </summary>
public int Sort { get; set; } = 0;
/// <summary>
/// 是否隐藏
/// </summary>
public bool IsHide { get; set; } = false;
/// <summary>
/// 是否缓存keep-alive
/// </summary>
public bool KeepAlive { get; set; } = false;
/// <summary>
/// 外链地址
/// </summary>
[MaxLength(500)]
public string? Link { get; set; }
/// <summary>
/// 是否 iframe 嵌入
/// </summary>
public bool IsIframe { get; set; } = false;
/// <summary>
/// 是否隐藏标签页
/// </summary>
public bool IsHideTab { get; set; } = false;
/// <summary>
/// 角色限制JSON 数组,如 ["R_SUPER", "R_ADMIN"]
/// </summary>
[MaxLength(500)]
public string? Roles { get; set; }
/// <summary>
/// 按钮权限列表JSON 数组)
/// </summary>
[MaxLength(1000)]
public string? AuthList { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
/// <summary>
/// 父菜单
/// </summary>
public Menu? Parent { get; set; }
/// <summary>
/// 子菜单
/// </summary>
public ICollection<Menu> Children { get; set; } = new List<Menu>();
/// <summary>
/// 角色菜单关联
/// </summary>
public ICollection<RoleMenu> RoleMenus { get; set; } = new List<RoleMenu>();
}