|
|
|
@ -42,28 +42,29 @@ namespace Myshipping.Core.Service
|
|
|
|
|
public async Task<dynamic> Page([FromQuery] QueryDjyCustomerInput input)
|
|
|
|
|
{
|
|
|
|
|
var entities = await _rep.AsQueryable()
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CodeName), u => u.CodeName.Contains(input.CodeName.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ShortName), u => u.ShortName.Contains(input.ShortName.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.FullName), u => u.FullName.Contains(input.FullName.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Chief), u => u.Chief.Contains(input.Chief.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Tel), u => u.Tel.Contains(input.Tel.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Email), u => u.Email.Contains(input.Email.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.QQ), u => u.QQ.Contains(input.QQ.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.WebUrl), u => u.WebUrl.Contains(input.WebUrl.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Province), u => u.Province.Contains(input.Province.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.City), u => u.City.Contains(input.City.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Addr), u => u.Addr.Contains(input.Addr.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.FullNameEN), u => u.FullNameEN.Contains(input.FullNameEN.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.AddrEN), u => u.AddrEN.Contains(input.AddrEN.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PropString), u => u.PropString.Contains(input.PropString.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.InvTitle), u => u.InvTitle.Contains(input.InvTitle.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.TaxNO), u => u.TaxNO.Contains(input.TaxNO.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.InvAddrTel), u => u.InvAddrTel.Contains(input.InvAddrTel.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.RMBBank), u => u.RMBBank.Contains(input.RMBBank.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.RmbAccount), u => u.RmbAccount.Contains(input.RmbAccount.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.USDBank), u => u.USDBank.Contains(input.USDBank.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.USDAccount), u => u.USDAccount.Contains(input.USDAccount.Trim()))
|
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
|
.Where(m => m.CreatedUserId == UserManager.UserId)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CodeName), u => u.CodeName.Contains(input.CodeName.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.ShortName), u => u.ShortName.Contains(input.ShortName.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.FullName), u => u.FullName.Contains(input.FullName.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Chief), u => u.Chief.Contains(input.Chief.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Tel), u => u.Tel.Contains(input.Tel.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Email), u => u.Email.Contains(input.Email.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.QQ), u => u.QQ.Contains(input.QQ.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.WebUrl), u => u.WebUrl.Contains(input.WebUrl.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Province), u => u.Province.Contains(input.Province.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.City), u => u.City.Contains(input.City.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Addr), u => u.Addr.Contains(input.Addr.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.FullNameEN), u => u.FullNameEN.Contains(input.FullNameEN.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.AddrEN), u => u.AddrEN.Contains(input.AddrEN.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PropString), u => u.PropString.Contains(input.PropString.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.InvTitle), u => u.InvTitle.Contains(input.InvTitle.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.TaxNO), u => u.TaxNO.Contains(input.TaxNO.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.InvAddrTel), u => u.InvAddrTel.Contains(input.InvAddrTel.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.RMBBank), u => u.RMBBank.Contains(input.RMBBank.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.RmbAccount), u => u.RmbAccount.Contains(input.RmbAccount.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.USDBank), u => u.USDBank.Contains(input.USDBank.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.USDAccount), u => u.USDAccount.Contains(input.USDAccount.Trim()))
|
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
|
return entities.XnPagedResult();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -73,13 +74,14 @@ namespace Myshipping.Core.Service
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/DjyCustomer/add"), SqlSugarUnitOfWork]
|
|
|
|
|
public async Task Add(AddDjyCustomerInput input)
|
|
|
|
|
public async Task<long> Add(AddDjyCustomerInput input)
|
|
|
|
|
{
|
|
|
|
|
var entity = input.Adapt<DjyCustomer>();
|
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
|
var contactList = input.Contacts.Adapt<List<DjyCustomerContact>>();
|
|
|
|
|
contactList.ForEach(x => x.CustomerId = entity.Id);
|
|
|
|
|
await _repContact.InsertAsync(contactList);
|
|
|
|
|
return entity.Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -88,7 +90,7 @@ namespace Myshipping.Core.Service
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/DjyCustomer/edit"), SqlSugarUnitOfWork]
|
|
|
|
|
public async Task Update(UpdateDjyCustomerInput input)
|
|
|
|
|
public async Task<long> Update(UpdateDjyCustomerInput input)
|
|
|
|
|
{
|
|
|
|
|
var find = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
|
|
|
|
|
if (find == null)
|
|
|
|
@ -102,6 +104,7 @@ namespace Myshipping.Core.Service
|
|
|
|
|
var contactList = input.Contacts.Adapt<List<DjyCustomerContact>>();
|
|
|
|
|
contactList.ForEach(x => x.CustomerId = entity.Id);
|
|
|
|
|
await _repContact.InsertAsync(contactList);
|
|
|
|
|
return entity.Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|