jianghaiqing 5 months ago
commit 89b620d3ce

@ -9179,7 +9179,7 @@
新增编辑船名映射信息
</summary>
</member>
<member name="M:Myshipping.Core.Service.CommonDBService.ForwarderList(Myshipping.Core.Service.NameQueryDto)">
<member name="M:Myshipping.Core.Service.CommonDBService.ForwarderList(Myshipping.Core.Service.CommonDB.Dto.ForwarderListInputDto)">
<summary>
获取船代列表信息
</summary>

@ -350,11 +350,19 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
/// 获取船代列表信息
/// </summary>
[HttpGet("/commondb/forwarderlist")]
public async Task<dynamic> ForwarderList([FromQuery] NameQueryDto input)
public async Task<dynamic> ForwarderList([FromQuery] ForwarderListInputDto input)
{
List<CodeForwarder> list = await _sysCacheService.GetAllCodeForwarder();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
// 如果装货港代码不为空,则根据装货港代码查询装货港与船代的映射关系
if (!string.IsNullOrEmpty(input.PortLoadCode))
{
List<string> forwarderCodeList = await _relaPortLoadForwarderRep.AsQueryable().Where(x => x.PortLoadCode == input.PortLoadCode).Select(x => x.ForwarderCode).ToListAsync();
queryList = queryList.Where(x => forwarderCodeList.Contains(x.Code)).ToList();
}
if (queryList.Count() > 20)
{
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
@ -522,7 +530,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => x.CarrierCode==input.CarrierCode);
.WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => x.CarrierCode == input.CarrierCode);
if (queryList.Count() > 20)
{
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Core.Service.CommonDB.Dto
namespace Myshipping.Core.Service.CommonDB.Dto
{
public class CodeForwarderDto
{
@ -65,4 +59,9 @@ namespace Myshipping.Core.Service.CommonDB.Dto
/// </summary>
public int Sort { get; set; }
}
public class ForwarderListInputDto: NameQueryDto
{
public string PortLoadCode { get; set; }
}
}

Loading…
Cancel
Save