From 59ae4434e770ea95f23fd7465ef7940098f6aaf0 Mon Sep 17 00:00:00 2001 From: gdlcf88 Date: Fri, 5 Jan 2024 17:18:00 +0800 Subject: [PATCH] Add `GetFileListInput.Filter` property --- common.props | 2 +- .../EasyAbp/FileManagement/Files/Dtos/GetFileListInput.cs | 8 +++++--- .../EasyAbp/FileManagement/Files/FileAppService.cs | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/common.props b/common.props index 8610f7f..35a0aea 100644 --- a/common.props +++ b/common.props @@ -1,7 +1,7 @@ latest - 5.2.0-preview.1 + 5.2.0-preview.2 $(NoWarn);CS1591 true EasyAbp Team diff --git a/src/EasyAbp.FileManagement.Application.Contracts/EasyAbp/FileManagement/Files/Dtos/GetFileListInput.cs b/src/EasyAbp.FileManagement.Application.Contracts/EasyAbp/FileManagement/Files/Dtos/GetFileListInput.cs index 645e8e8..da89172 100644 --- a/src/EasyAbp.FileManagement.Application.Contracts/EasyAbp/FileManagement/Files/Dtos/GetFileListInput.cs +++ b/src/EasyAbp.FileManagement.Application.Contracts/EasyAbp/FileManagement/Files/Dtos/GetFileListInput.cs @@ -7,12 +7,14 @@ namespace EasyAbp.FileManagement.Files.Dtos public class GetFileListInput : PagedAndSortedResultRequestDto { public Guid? ParentId { get; set; } - + [Required] public string FileContainerName { get; set; } - + public Guid? OwnerUserId { get; set; } - + public bool DirectoryOnly { get; set; } + + public string Filter { get; set; } } } \ No newline at end of file diff --git a/src/EasyAbp.FileManagement.Application/EasyAbp/FileManagement/Files/FileAppService.cs b/src/EasyAbp.FileManagement.Application/EasyAbp/FileManagement/Files/FileAppService.cs index ee79ffe..3543f94 100644 --- a/src/EasyAbp.FileManagement.Application/EasyAbp/FileManagement/Files/FileAppService.cs +++ b/src/EasyAbp.FileManagement.Application/EasyAbp/FileManagement/Files/FileAppService.cs @@ -152,7 +152,8 @@ protected override async Task> CreateFilteredQueryAsync(GetFile return (await _repository.GetQueryableAsync()) .Where(x => x.ParentId == input.ParentId && x.OwnerUserId == input.OwnerUserId && x.FileContainerName == input.FileContainerName) - .WhereIf(input.DirectoryOnly, x => x.FileType == FileType.Directory); + .WhereIf(input.DirectoryOnly, x => x.FileType == FileType.Directory) + .WhereIf(!input.Filter.IsNullOrWhiteSpace(), x => x.FileName.Contains(input.Filter)); } [Authorize]