公共库返回条数

optimize
wet 2 years ago
parent c301401e25
commit a863bc80b0

@ -116,7 +116,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|| x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -170,7 +170,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -225,7 +225,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x=>x.Sort).Take(10).ToList();
}
@ -281,7 +281,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|| x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -336,7 +336,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
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 (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -388,7 +388,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
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 (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -446,7 +446,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -502,7 +502,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -559,7 +559,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -614,7 +614,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count()>20) {
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
@ -672,7 +672,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
@ -724,7 +724,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|| x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x=>x.Sort).ToList();
}
@ -780,7 +780,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -830,7 +830,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|| x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -888,7 +888,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -940,7 +940,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -1010,7 +1010,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
@ -1066,7 +1066,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -1121,7 +1121,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -1171,7 +1171,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}

@ -12,11 +12,14 @@ namespace Myshipping.Core.Service
//KeyWord
public class NameQueryDto
{
/// <summary>
/// 关键字
/// </summary>
public string KeyWord { get; set; }
public int Limit { get; set; } = 10;
}
public class MappingQueryDto
@ -32,6 +35,8 @@ namespace Myshipping.Core.Service
/// 关键字
/// </summary>
public string KeyWord { get; set; }
public int Limit { get; set; } = 10;
}
}

Loading…
Cancel
Save