You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

52 lines
1.3 KiB

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