using ZhonTai.Common.Domain.Entities;
using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using ZhonTai.Plate.Admin.Domain.Permission;
using ZhonTai.Plate.Admin.Domain.User;
using ZhonTai.Plate.Admin.Domain.UserRole;
using ZhonTai.Plate.Admin.Domain.RolePermission;
namespace ZhonTai.Plate.Admin.Domain.Role
{
///
/// 角色
///
[Table(Name = "ad_role")]
[Index("idx_{tablename}_01", nameof(Name) + "," + nameof(TenantId), true)]
[Index("idx_{tablename}_02", nameof(Code) + "," + nameof(TenantId), true)]
public class RoleEntity : EntityFull, ITenant
{
///
/// 租户Id
///
[Column(Position = -10, CanUpdate = false)]
public long? TenantId { get; set; }
///
/// 名称
///
[Column(StringLength = 50)]
public string Name { get; set; }
///
/// 编码
///
[Column(StringLength = 50)]
public string Code { get; set; }
///
/// 说明
///
[Column(StringLength = 200)]
public string Description { get; set; }
///
/// 启用
///
public bool Enabled { get; set; } = true;
///
/// 排序
///
public int Sort { get; set; }
[Navigate(ManyToMany = typeof(UserRoleEntity))]
public ICollection Users { get; set; }
[Navigate(ManyToMany = typeof(RolePermissionEntity))]
public ICollection Permissions { get; set; }
}
}