using SqlSugar;
using System.ComponentModel.DataAnnotations;
using WoodWood.Util.Validations;
namespace Wood.Entity.SystemManage
{
public class RoleEntityShared : EntityTenantBaseExtra
{
///
/// 角色名
///
[SugarColumn(ColumnDescription = "角色名", Length = 16)]
[Required]
public string RoleName { get; set; } = "";
///
/// 编码
///
[SugarColumn(ColumnDescription = "编码", Length = 16)]
[Required]
[UniqueValue(EntityType=typeof(RoleEntity), ErrorMessage ="角色编码不能重复!")]
public string FormCode { get; set; } = "";
///
/// 数据范围类型
///
[SugarColumn(ColumnDescription = "数据范围类型", Length = 16)]
[Required]
public DataScopeTypeEnum DataScopeType { get; set; } = DataScopeTypeEnum.All;
///
/// 排序
///
[SugarColumn(ColumnDescription = "排序", DefaultValue = "0")]
public int Sort { get; set; } = 0;
}
///
/// 角色
///
[SugarTable("SysRole", "角色")]
public class RoleEntity : RoleEntityShared
{
///
/// 用户信息
///
[Navigate(typeof(UserBelongRoleEntity), nameof(UserBelongRoleEntity.RoleId), nameof(UserBelongRoleEntity.UserId))]//注意顺序
public List? Users { get; set; }
}
}