|
|
|
@ -22,13 +22,14 @@ namespace Myshipping.Core.Service
|
|
|
|
|
private readonly SqlSugarRepository<DjyTenantParamItem> _itemrep;
|
|
|
|
|
private readonly SqlSugarRepository<DjyTenantParamValue> _valuerep;
|
|
|
|
|
private readonly ILogger<DjyTenantParam> _logger;
|
|
|
|
|
|
|
|
|
|
public DjyTenantParamService(SqlSugarRepository<DjyTenantParam> rep, SqlSugarRepository<DjyTenantParamItem> itemrep, SqlSugarRepository<DjyTenantParamValue> valuerep, ILogger<DjyTenantParam> logger)
|
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
|
|
public DjyTenantParamService(SqlSugarRepository<DjyTenantParam> rep, SqlSugarRepository<DjyTenantParamItem> itemrep, SqlSugarRepository<DjyTenantParamValue> valuerep, ISysCacheService cache, ILogger<DjyTenantParam> logger)
|
|
|
|
|
{
|
|
|
|
|
_rep = rep;
|
|
|
|
|
_logger = logger;
|
|
|
|
|
_itemrep = itemrep;
|
|
|
|
|
_valuerep = valuerep;
|
|
|
|
|
_cache = cache;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -112,6 +113,7 @@ namespace Myshipping.Core.Service
|
|
|
|
|
{
|
|
|
|
|
var entity = input.Adapt<DjyTenantParamItem>();
|
|
|
|
|
await _itemrep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -126,6 +128,7 @@ namespace Myshipping.Core.Service
|
|
|
|
|
|
|
|
|
|
await _valuerep.DeleteAsync(m => m.ItemCode == entity.ItemCode && m.ParaCode == entity.ParaCode);
|
|
|
|
|
await _itemrep.DeleteAsync(entity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -151,6 +154,7 @@ namespace Myshipping.Core.Service
|
|
|
|
|
{
|
|
|
|
|
var entity = input.Adapt<DjyTenantParamValue>();
|
|
|
|
|
await _valuerep.InsertAsync(entity);
|
|
|
|
|
await CacheData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -163,6 +167,7 @@ namespace Myshipping.Core.Service
|
|
|
|
|
{
|
|
|
|
|
var entity = input.Adapt<DjyTenantParamValue>();
|
|
|
|
|
await _valuerep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
await CacheData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -176,5 +181,13 @@ namespace Myshipping.Core.Service
|
|
|
|
|
var entity = await _itemrep.FirstOrDefaultAsync(u => u.Id == Id);
|
|
|
|
|
await _valuerep.DeleteAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task CacheData()
|
|
|
|
|
{
|
|
|
|
|
var list = await _valuerep.AsQueryable().ToListAsync();
|
|
|
|
|
|
|
|
|
|
await _cache.SetAllTenantParam(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|