|
|
|
@ -54,17 +54,20 @@ namespace Myshipping.Core.Service
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/DjyEdiSetting/add")]
|
|
|
|
|
public async Task Add(AddDjyEdiSettingInput input)
|
|
|
|
|
public async Task<long> Add(AddDjyEdiSettingInput input)
|
|
|
|
|
{
|
|
|
|
|
var cc = _rep.Count(x => x.EDICODE == input.EDICODE && x.TenantId == input.TenantId);
|
|
|
|
|
var cc = _rep.AsQueryable()
|
|
|
|
|
.Filter(null, true)
|
|
|
|
|
.Count(x => x.EDICODE == input.EDICODE && x.TenantId == input.TenantId && x.CARRIERID == input.CARRIERID);
|
|
|
|
|
if (cc > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"该租户({input.TenantName})已存在相同类型({input.EDICODE})的参数设置");
|
|
|
|
|
throw Oops.Bah($"该租户({input.TenantName})已存在相同类型({input.EDICODE})相同船司({input.CARRIERID})的参数设置");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var entity = input.Adapt<DjyEdiSetting>();
|
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
|
await CacheData();
|
|
|
|
|
return entity.Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -73,18 +76,28 @@ namespace Myshipping.Core.Service
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/DjyEdiSetting/edit")]
|
|
|
|
|
public async Task Update(UpdateDjyEdiSettingInput input)
|
|
|
|
|
public async Task<long> Update(UpdateDjyEdiSettingInput input)
|
|
|
|
|
{
|
|
|
|
|
var entity = _rep.FirstOrDefault(x => x.EDICODE == input.EDICODE && x.TenantId == input.TenantId);
|
|
|
|
|
var entity = _rep.AsQueryable()
|
|
|
|
|
.Filter(null, true)
|
|
|
|
|
.First(x => x.Id == input.Id);
|
|
|
|
|
if (entity == null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"未找到数据");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var cc = _rep.AsQueryable().Filter(null, true)
|
|
|
|
|
.Count(x => x.EDICODE == input.EDICODE && x.TenantId == input.TenantId && x.CARRIERID == input.CARRIERID && x.Id != input.Id);
|
|
|
|
|
if (cc > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"该租户({input.TenantName})已存在相同类型({input.EDICODE})相同船司({input.CARRIERID})的参数设置");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
entity = input.Adapt(entity);
|
|
|
|
|
await _rep.UpdateAsync(entity);
|
|
|
|
|
|
|
|
|
|
await CacheData();
|
|
|
|
|
return entity.Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -95,7 +108,8 @@ namespace Myshipping.Core.Service
|
|
|
|
|
[HttpPost("/DjyEdiSetting/delete")]
|
|
|
|
|
public async Task Delete(GetDjyEdiSettingInput input)
|
|
|
|
|
{
|
|
|
|
|
var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
|
var entity = await _rep.AsQueryable().Filter(null, true)
|
|
|
|
|
.FirstAsync(u => u.Id == input.Id);
|
|
|
|
|
if (entity == null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"未找到数据");
|
|
|
|
@ -112,7 +126,7 @@ namespace Myshipping.Core.Service
|
|
|
|
|
[HttpGet("/DjyEdiSetting/detail")]
|
|
|
|
|
public async Task<DjyEdiSetting> Get([FromQuery] GetDjyEdiSettingInput input)
|
|
|
|
|
{
|
|
|
|
|
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
|
return await _rep.AsQueryable().Filter(null, true).FirstAsync(u => u.Id == input.Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|