|
|
@ -67,6 +67,26 @@ public abstract class SfsBaseDataWithCodeAppServiceBase<TEntity, TEntityDto, TRe |
|
|
|
return dtoList; |
|
|
|
} |
|
|
|
|
|
|
|
[AllowAnonymous] |
|
|
|
[HttpPost("by-codes-with-post")] |
|
|
|
public virtual async Task<List<TEntityDto>> GetByCodesWithPostAsync(IEnumerable<string> codes) |
|
|
|
{ |
|
|
|
|
|
|
|
var dtoList = new List<TEntityDto>(); |
|
|
|
foreach (var code in codes) |
|
|
|
{ |
|
|
|
var dto = await Cache.GetOrAddItemAsync( |
|
|
|
$"{typeof(TEntityDto).Name}:{code}".ToString(), |
|
|
|
async () => await GetFromRepositoryAsync(code).ConfigureAwait(false), |
|
|
|
SfsCacheConst.SeveralMinutes).ConfigureAwait(false); |
|
|
|
if (dto != null) |
|
|
|
{ |
|
|
|
dtoList.Add(dto); |
|
|
|
} |
|
|
|
} |
|
|
|
return dtoList; |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual async Task<TEntityDto> GetFromRepositoryAsync(string code) |
|
|
|
{ |
|
|
|
// var entity = await _repository.FindAsync(p => p.Code == code);
|
|
|
|