| | |
| | | /// <summary> |
| | | /// 菜单 |
| | | /// </summary> |
| | | public class Menu : CommonEntity, IEntityTypeBuilder<Menu> |
| | | public class Menu : CommonEntity, IEntityTypeBuilder<Menu>, IIsDisabled |
| | | { |
| | | public Menu() |
| | | { |
| | | Childrens = []; |
| | | Children = []; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 用户类型 |
| | | /// </summary> |
| | | public EnumUserType UserType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 客户端类型 |
| | | /// </summary> |
| | | public EnumClientType ClientType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 上级Id |
| | |
| | | /// <summary> |
| | | /// 下级 |
| | | /// </summary> |
| | | public List<Menu> Childrens { get; set; } |
| | | public List<Menu> Children { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 菜单路径 |
| | | /// </summary> |
| | | public string Path { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 编号 |
| | |
| | | public string Group { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 绑定字段 |
| | | /// 位置(用于按钮) |
| | | /// </summary> |
| | | public string BindField { get; set; } |
| | | public string Location { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 列宽(用于按钮/列/元素) |
| | | /// </summary> |
| | | public string Width { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 是否禁用 |
| | | /// </summary> |
| | | public bool IsDisabled { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 是否隐藏 |
| | | /// </summary> |
| | | public bool IsHidden { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 是否缓存 |
| | |
| | | public void Configure(EntityTypeBuilder<Menu> entityBuilder, DbContext dbContext, Type dbContextLocator) |
| | | { |
| | | entityBuilder |
| | | .HasMany(x => x.Childrens) |
| | | .HasMany(x => x.Children) |
| | | .WithOne(x => x.Parent) |
| | | .HasForeignKey(x => x.ParentId) |
| | | .OnDelete(DeleteBehavior.ClientSetNull); |