You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.8 KiB
69 lines
2.8 KiB
using System.Data;
|
|
using System.Threading.Tasks;
|
|
using Znyc.Cloudcar.Admin.Commons.Dtos;
|
|
using Znyc.Cloudcar.Admin.Commons.Mapping;
|
|
using Znyc.Cloudcar.Admin.Commons.Pages;
|
|
using Znyc.Cloudcar.Admin.Commons.Services;
|
|
using Znyc.Cloudcar.Admin.Security.Dtos;
|
|
using Znyc.Cloudcar.Admin.Security.Entitys;
|
|
using Znyc.Cloudcar.Admin.Security.IRepositories;
|
|
using Znyc.Cloudcar.Admin.Security.IServices;
|
|
|
|
namespace Znyc.Cloudcar.Admin.Security.Services
|
|
{
|
|
/// <summary>
|
|
/// </summary>
|
|
public class UploadFileService : BaseService<UploadFileEntity, UploadFileOutputDto, long>, IUploadFileService
|
|
{
|
|
private readonly IUploadFileRepository _uploadFileRepository;
|
|
|
|
public UploadFileService(IUploadFileRepository repository) : base(repository)
|
|
{
|
|
_uploadFileRepository = repository;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据应用Id和应用标识批量更新数据
|
|
/// </summary>
|
|
/// <param name="beLongAppId">应用Id</param>
|
|
/// <param name="oldBeLongAppId">更新前旧的应用Id</param>
|
|
/// <param name="belongApp">应用标识</param>
|
|
/// <param name="trans"></param>
|
|
/// <returns></returns>
|
|
public bool UpdateByBeLongAppId(string beLongAppId, string oldBeLongAppId, string belongApp = null,
|
|
IDbTransaction trans = null)
|
|
{
|
|
return _uploadFileRepository.UpdateByBeLongAppId(beLongAppId, oldBeLongAppId, belongApp, trans);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据条件查询数据库,并返回对象集合(用于分页数据显示)
|
|
/// </summary>
|
|
/// <param name="search">查询的条件</param>
|
|
/// <returns>指定对象的集合</returns>
|
|
public override async Task<PageResult<UploadFileOutputDto>> FindWithPagerAsync(
|
|
SearchInputDto<UploadFileEntity> search)
|
|
{
|
|
bool order = search.Order == "asc" ? false : true;
|
|
string where = GetDataPrivilege(false);
|
|
if (!string.IsNullOrEmpty(search.Keywords))
|
|
{
|
|
@where += string.Format(" and FileName like '%{0}%' ", search.Keywords);
|
|
};
|
|
PagerInfo pagerInfo = new PagerInfo
|
|
{
|
|
CurrenetPageIndex = search.CurrenetPageIndex,
|
|
PageSize = search.PageSize
|
|
};
|
|
System.Collections.Generic.List<UploadFileEntity> list = await repository.FindWithPagerAsync(where, pagerInfo, search.Sort, order);
|
|
PageResult<UploadFileOutputDto> pageResult = new PageResult<UploadFileOutputDto>
|
|
{
|
|
CurrentPage = pagerInfo.CurrenetPageIndex,
|
|
Items = list.MapTo<UploadFileOutputDto>(),
|
|
ItemsPerPage = pagerInfo.PageSize,
|
|
TotalItems = pagerInfo.RecordCount
|
|
};
|
|
return pageResult;
|
|
}
|
|
}
|
|
}
|