客户编辑

master
wanghaomei 7 months ago
parent dee43c4e29
commit 7b32e4594c

@ -12103,6 +12103,11 @@
订舱客户新增输入参数
</summary>
</member>
<member name="P:Myshipping.Core.Service.AddDjyCustomerInput.Contacts">
<summary>
联系人
</summary>
</member>
<member name="T:Myshipping.Core.Service.UpdateDjyCustomerInput">
<summary>
订舱客户修改输入参数
@ -12113,6 +12118,11 @@
主键
</summary>
</member>
<member name="P:Myshipping.Core.Service.UpdateDjyCustomerInput.Contacts">
<summary>
联系人
</summary>
</member>
<member name="T:Myshipping.Core.Service.GetDjyCustomerInput">
<summary>
订舱客户获取(删除)输入参数

@ -154,10 +154,36 @@ namespace Myshipping.Core.Service
}
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
await _repContact.DeleteAsync(x => x.CustomerId == input.Id);
var contactList = input.Contacts.Adapt<List<DjyCustomerContact>>();
contactList.ForEach(x => x.CustomerId = entity.Id);
await _repContact.InsertAsync(contactList);
//await _repContact.DeleteAsync(x => x.CustomerId == input.Id);
//var contactList = input.Contacts.Adapt<List<DjyCustomerContact>>();
//contactList.ForEach(x => x.CustomerId = entity.Id);
//await _repContact.InsertAsync(contactList);
var dbContact = await _repContact.AsQueryable().Where(x => x.CustomerId == input.Id).ToListAsync();
foreach (var dtoUser in input.Contacts)
{
if (dtoUser.Id > 0)
{
var contact = dbContact.First(x => x.Id == dtoUser.Id);
dtoUser.Adapt(contact);
contact.CustomerId = entity.Id;
await _repContact.UpdateAsync(contact);
dbContact.Remove(contact);
}
else
{
var contact = dtoUser.Adapt<DjyCustomerContact>();
contact.CustomerId = entity.Id;
await _repContact.InsertAsync(contact);
}
}
foreach (var contact in dbContact)
{
await _repContact.DeleteAsync(contact);
}
//地址
await _repAddr.DeleteAsync(x => x.CustomerId == input.Id);
var addrList = input.Addrs.Adapt<List<DjyCustomerAddr>>();

@ -12,7 +12,7 @@ namespace Myshipping.Core.Service
{
public DjyCustomerInput()
{
this.Contacts = new List<AddDjyCustomerContactInput>();
//this.Contacts = new List<AddDjyCustomerContactInput>();
this.Addrs = new List<DjyCustomerAddrInput>();
}
@ -168,7 +168,6 @@ namespace Myshipping.Core.Service
/// 服务项目
/// </summary>
public string ServiceItem { get; set; }
public List<AddDjyCustomerContactInput> Contacts { get; set; }
/// <summary>
/// 地址列表
@ -181,6 +180,10 @@ namespace Myshipping.Core.Service
/// </summary>
public class AddDjyCustomerInput : DjyCustomerInput
{
/// <summary>
/// 联系人
/// </summary>
public List<AddDjyCustomerContactInput> Contacts { get; set; } = new List<AddDjyCustomerContactInput>();
}
@ -195,6 +198,10 @@ namespace Myshipping.Core.Service
[Required(ErrorMessage = "主键不能为空")]
public long Id { get; set; }
/// <summary>
/// 联系人
/// </summary>
public List<UpdateDjyCustomerContactInput> Contacts { get; set; } = new List<UpdateDjyCustomerContactInput>();
}
/// <summary>

Loading…
Cancel
Save