HaniBlindBox/server/HoneyBox/src/HoneyBox.Admin/Entities/Role.cs
2026-01-04 01:47:02 +08:00

81 lines
1.8 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;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HoneyBox.Admin.Entities;
/// <summary>
/// 角色
/// </summary>
[Table("roles")]
public class Role
{
/// <summary>
/// 主键ID
/// </summary>
[Key]
public long Id { get; set; }
/// <summary>
/// 角色名称
/// </summary>
[Required]
[MaxLength(50)]
public string Name { get; set; } = null!;
/// <summary>
/// 角色编码
/// </summary>
[Required]
[MaxLength(50)]
public string Code { get; set; } = null!;
/// <summary>
/// 角色描述
/// </summary>
[MaxLength(500)]
public string? Description { get; set; }
/// <summary>
/// 排序号
/// </summary>
public int SortOrder { get; set; } = 0;
/// <summary>
/// 状态0禁用 1启用
/// </summary>
public byte Status { get; set; } = 1;
/// <summary>
/// 是否系统角色(系统角色不可删除)
/// </summary>
public bool IsSystem { get; set; } = false;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreatedAt { get; set; } = DateTime.Now;
/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdatedAt { get; set; }
// 导航属性
/// <summary>
/// 用户角色关联
/// </summary>
public virtual ICollection<AdminUserRole> AdminUserRoles { get; set; } = new List<AdminUserRole>();
/// <summary>
/// 角色菜单关联
/// </summary>
public virtual ICollection<RoleMenu> RoleMenus { get; set; } = new List<RoleMenu>();
/// <summary>
/// 角色权限关联
/// </summary>
public virtual ICollection<RolePermission> RolePermissions { get; set; } = new List<RolePermission>();
}