2025-04-24 18:31:27 +08:00

65 lines
1.5 KiB
C#

using MyCode.Project.Infrastructure.Common;
using MyCode.Project.Infrastructure.Extensions;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyCode.Project.Domain.Businesses.Menus
{
/// <summary>
/// 角色模块
/// </summary>
public class RoleModule
{
/// <summary>
/// 模块ID
/// </summary>
public Guid? ModuleId { get; set; }
/// <summary>
/// 功能点
/// </summary>
[JsonIgnore]
public string FuncPoint { get; set; }
/// <summary>
/// 菜单按钮
/// </summary>
public MenuButtonCheck MenuPower { get; set; }
/// <summary>
/// 初始化菜单按钮
/// </summary>
public void InitPower()
{
if (FuncPoint.IsEmpty())
{
return;
}
MenuPower = JsonHelper.ToObject<MenuButtonCheck>(FuncPoint);
}
/// <summary>
/// 是否存在选中按钮
/// </summary>
/// <returns></returns>
public bool ExistsCheckedButton()
{
if (MenuPower == null)
{
return false;
}
if (MenuPower.Page.Any(x => x.Value) || MenuPower.PageList.Any(x => x.Value) || MenuPower.ChildrenList.Any(x => x.Value))
{
return true;
}
return false;
}
}
}