//
namespace SafeCampus.System;
///
///
///
public class FileService : DbRepository, IFileService
{
private readonly IConfigService _configService;
public FileService(IConfigService configService)
{
_configService = configService;
}
///
public async Task> Page(FilePageInput input)
{
var query = Context.Queryable().WhereIF(!string.IsNullOrEmpty(input.Engine), it => it.Engine == input.Engine)//根据关键字查询
.WhereIF(!string.IsNullOrEmpty(input.SearchKey), it => it.Name.Contains(input.SearchKey))//根据关键字查询
.OrderByIF(!string.IsNullOrEmpty(input.SortField), $"{input.SortField} {input.SortOrder}")//排序
.OrderBy(it => it.Id);
var pageInfo = await query.ToPagedListAsync(input.PageNum, input.PageSize);//分页
return pageInfo;
}
///
public async Task UploadFile(string engine, IFormFile file)
{
return await StorageFile(engine, file);
}
///
public async Task Delete(BaseIdListInput input)
{
var ids = input.Ids;//获取ID
await DeleteByIdsAsync(ids.Cast