using FluentValidation;
namespace DS.WMS.Core.Sys.Dtos;
///
/// 权限输入实体
///
public class PermissionReq
{
///
/// 主键
///
public long? Id { get; set; }
///
///上级权限ID
///
public long ParentId { get; set; } = 0;
///
/// 权限名称
///
public string PermissionName { get; set; }
///
///权限唯一码
///
public string PermissionCode { get; set; }
///
/// 菜单名称
///
public string Title
{
get
{
return this.PermissionName;
}
}
///
/// 权限图标
///
public string Icon { get; set; } = "";
///
/// 路径
///
public string Url { get; set; } = "";
///
/// 跳转
///
public string Redirect { get; set; } = "";
///
/// 组件
///
public string Component { get; set; } = "";
///
/// 权限类型
/// 1:目录; 2:子菜单:3:按钮权限
///
public int MenuType { get; set; }
///
/// 外链菜单打开方式 0/内部打开 1/外部打开
///
public int OpenType { get; set; }
///
///权限模板 0: 公共; 1:客户端; 2:市平台:3:省平台
///
public int PermissionType { get; set; } = 0;
///
/// 排序码
///
public int SortCode { get; set; }
///
/// 是否隐藏路由
///
public bool IsHidden { get; set; } = false;
}
///
/// 验证
///
public class PermissionValidator : AbstractValidator
{
///
/// 构造函数
///
public PermissionValidator()
{
this.RuleFor(o => o.PermissionName)
.NotEmpty().WithName("权限名称");
this.RuleFor(o => o.PermissionCode)
.NotEmpty().WithName("权限唯一码");
// this.RuleFor(o => o.Component)
// .NotEmpty().WithName("组件");
this.RuleFor(o => o.MenuType)
.NotEmpty().WithName("权限类型");
}
}