using FluentValidation; namespace DS.WMS.Core.System.Dtos; /// /// 公告录入实体 /// public class NoticeInput { public string Id { get; set; } /// /// 标题 /// public string Title { get; set; } /// /// 类型 /// public string Type { get; set; } /// /// 内容 /// public string Content { get; set; } /// /// 优先级 /// public string Level { get; set; } = "L"; /// /// Desc:截至日期 /// Default: /// Nullable:True /// public DateTime? EndTime { get; set; } /// /// 通告对象类型 (CLIENT:指定客户,ALL:全体客户) /// public string MsgType { get; set; } /// /// 指定客户 /// public string ClientIds { get; set; } } /// /// 验证 /// public class NoticeInputValidator : AbstractValidator { /// /// 构造函数 /// public NoticeInputValidator() { this.RuleFor(o => o.Title) .NotEmpty().WithMessage("标题"); this.RuleFor(o => o.Content) .NotEmpty().WithMessage("公告内容"); this.RuleFor(o => o.Type) .NotEmpty().WithMessage("公告类型"); this.RuleFor(o => o.EndTime) .NotEmpty().WithMessage("截止日期"); } }