You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
3.3 KiB
C#
144 lines
3.3 KiB
C#
using FluentValidation;
|
|
|
|
namespace DS.WMS.Core.Sys.Dtos;
|
|
|
|
/// <summary>
|
|
/// 权限输入实体
|
|
/// </summary>
|
|
public class PermissionReq
|
|
{
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public long? Id { get; set; }
|
|
|
|
/// <summary>
|
|
///上级权限ID
|
|
/// </summary>
|
|
public long ParentId { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// 权限名称
|
|
/// </summary>
|
|
public string PermissionName { get; set; }
|
|
|
|
/// <summary>
|
|
///权限唯一码
|
|
/// </summary>
|
|
public string PermissionCode { get; set; }
|
|
|
|
/// <summary>
|
|
/// 菜单名称
|
|
/// </summary>
|
|
public string Title
|
|
{
|
|
get
|
|
{
|
|
return this.PermissionName;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 权限图标
|
|
/// </summary>
|
|
public string Icon { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// 路径
|
|
/// </summary>
|
|
public string Url { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// 跳转
|
|
/// </summary>
|
|
public string Redirect { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// 组件
|
|
/// </summary>
|
|
public string Component { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// 权限类型
|
|
/// 1:目录; 2:子菜单:3:按钮权限
|
|
/// </summary>
|
|
public int MenuType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 外链菜单打开方式 0/内部打开 1/外部打开
|
|
/// </summary>
|
|
public int OpenType { get; set; }
|
|
|
|
/// <summary>
|
|
///权限模板 0: 公共; 1:客户端; 2:市平台:3:省平台
|
|
/// </summary>
|
|
public int PermissionType { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// 排序码
|
|
/// </summary>
|
|
public int SortCode { get; set; }
|
|
|
|
/// <summary>
|
|
/// 备注
|
|
/// </summary>
|
|
public string Note { get; set; }
|
|
/// <summary>
|
|
/// 是否隐藏路由
|
|
/// </summary>
|
|
public bool IsHidden { get; set; } = false;
|
|
/// <summary>
|
|
/// 权限名称-英文
|
|
/// </summary>
|
|
public string PermissionEnName { get; set; }
|
|
/// <summary>
|
|
/// 权限名称-法文
|
|
/// </summary>
|
|
public string PermissionFrName { get; set; }
|
|
/// <summary>
|
|
/// 权限名称-俄文
|
|
/// </summary>
|
|
public string PermissionRuName { get; set; }
|
|
/// <summary>
|
|
/// 权限名称-阿拉伯文
|
|
/// </summary>
|
|
public string PermissionArName { get; set; }
|
|
/// <summary>
|
|
/// 权限名称-西班牙文
|
|
/// </summary>
|
|
public string PermissionEsName { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否缓存标识
|
|
/// </summary>
|
|
public bool IsCache { get; set; } = false;
|
|
/// <summary>
|
|
///权限实体
|
|
/// </summary>
|
|
public string PermissionEntity { get; set; } = "";
|
|
/// <summary>
|
|
/// 中文视图名
|
|
/// </summary>
|
|
public string ColumnView { get; set; } = "";
|
|
}
|
|
|
|
/// <summary>
|
|
/// 验证
|
|
/// </summary>
|
|
public class PermissionValidator : AbstractValidator<PermissionReq>
|
|
{
|
|
/// <summary>
|
|
/// 构造函数
|
|
/// </summary>
|
|
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("权限类型");
|
|
}
|
|
} |