|
|
|
@ -101,6 +101,8 @@ namespace Myshipping.Application
|
|
|
|
|
await _repCode.UpdateAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await CacheFeeCode();
|
|
|
|
|
|
|
|
|
|
return entity.Adapt<FeeCodeSaveDto>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -129,6 +131,43 @@ namespace Myshipping.Application
|
|
|
|
|
var list = await _repCode.AsQueryable().Filter(null, true).Where(x => ids.Contains(x.Id)).ToListAsync();
|
|
|
|
|
list.ForEach(x => x.IsDeleted = true);
|
|
|
|
|
await _repCode.AsUpdateable(list).ExecuteCommandAsync();
|
|
|
|
|
await CacheFeeCode();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取费用代码列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/FeeCode/List")]
|
|
|
|
|
public async Task<List<FeeCodeCacheDto>> List()
|
|
|
|
|
{
|
|
|
|
|
var cacheList = await _cache.GetAsync<List<FeeCodeCacheDto>>(CommonConst.CACHE_KEY_FEE_CODE);
|
|
|
|
|
if (cacheList?.Any() == true)
|
|
|
|
|
{
|
|
|
|
|
List<FeeCodeCacheDto> result = cacheList.Where(f => f.TenantId == UserManager.TENANT_ID).ToList();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var cacheFeeCode = await CacheFeeCode();
|
|
|
|
|
|
|
|
|
|
List<FeeCodeCacheDto> result = cacheFeeCode.Where(f => f.TenantId == UserManager.TENANT_ID).ToList();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 缓存费用代码列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<FeeCodeCacheDto>> CacheFeeCode()
|
|
|
|
|
{
|
|
|
|
|
var allFeeCode = await _repCode.AsQueryable().Filter(null, true).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var cacheFeeCode = allFeeCode.Adapt<List<FeeCodeCacheDto>>();
|
|
|
|
|
await _cache.SetAsync(CommonConst.CACHE_KEY_FEE_CODE, cacheFeeCode);
|
|
|
|
|
|
|
|
|
|
return cacheFeeCode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|