using Microsoft.AspNetCore.Http; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace Magic.Core.Service; /// /// 文档输入参数 /// public class DocumentInput : PageInputBase { /// /// 父Id /// public virtual long? PId { get; set; } = 0; /// /// 父ID列表 /// public virtual string PIds { get; set; } /// /// 名称 /// public virtual string Name { get; set; } /// /// 文档类型:文件、文件夹 /// public virtual DocumentType? DocumentType { get; set; } /// /// 文件后缀 /// public virtual string FileSuffix { get; set; } /// /// 文件大小kb /// public virtual int? FileSizeKb { get; set; } /// /// 存储后的文件名 /// public virtual string FileObjectName { get; set; } /// /// 标签 /// public virtual int? Label { get; set; } /// /// 备注 /// public virtual string Remark { get; set; } /// /// 创建开始时间 /// public DateTime? CreateTimeStart { get; set; } /// /// 创建结束时间 /// public DateTime? CreateTimeEnd { get; set; } /// /// 修改结束时间 /// public DateTime? UpdateTimeStart { get; set; } /// /// 修改结束时间 /// public DateTime? UpdateTimeEnd { get; set; } /// /// 文件类型 /// public string FileType { get; set; } /// /// 是否删除 /// public bool IsDelete = false; } public class AddDocumentInput : DocumentInput { } /// /// 上传文件输入参数 /// public class DocumentUploadInput : DocumentInput { public List Files { get; set; } } public class DeleteDocumentInput { /// /// Id /// [Required(ErrorMessage = "Id不能为空")] public long Id { get; set; } } /// /// 批量删除入参 /// public class DeletesDocumentInput { /// /// Id列表 /// [Required(ErrorMessage = "Id列表不能为空")] public List? Ids { get; set; } } /// /// 移动入参 /// public class MoveDocumentInput { /// /// Id列表 /// [Required(ErrorMessage = "Id列表不能为空")] public List? Ids { get; set; } /// /// 父Id /// public long? PId { get; set; } } public class UpdateDocumentInput : DocumentInput, IValidatableObject { /// /// Id /// [Required(ErrorMessage = "Id不能为空")] public long? Id { get; set; } public IEnumerable Validate(ValidationContext validationContext) { if (Name.Split(".").Length > 1) { yield return new ValidationResult( "名称不能带'.'" , new[] { nameof(Name) } ); } } } public class QueryeDocumentInput : DeleteDocumentInput { }