jianghaiqing 2 years ago
commit 52a0172c7d

@ -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)); || x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20) 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(); 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)); || x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20) 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(); 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)); var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20) 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(); 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)); || x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20) 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(); 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)); 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) 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(); 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)); 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) 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(); 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)); || x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20) 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(); return queryList.OrderBy(x => x.Sort).ToList();
} }
@ -502,7 +502,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
if (queryList.Count() > 20) 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(); 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)); || x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20) 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(); 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) 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)); || 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) { 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(); 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)); || x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20) 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(); 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)); || x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20) 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(); return queryList.OrderBy(x=>x.Sort).ToList();
} }
@ -780,7 +780,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
if (queryList.Count() > 20) 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(); 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)); || x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20) 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(); return queryList.OrderBy(x => x.Sort).ToList();
} }
@ -888,7 +888,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
if (queryList.Count() > 20) 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(); return queryList.OrderBy(x => x.Sort).ToList();
} }
@ -940,7 +940,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
if (queryList.Count() > 20) 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(); 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)); || x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20) 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(); return queryList.OrderBy(x => x.Sort).ToList();
@ -1066,7 +1066,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
if (queryList.Count() > 20) 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(); 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)); || x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20) 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(); return queryList.OrderBy(x => x.Sort).ToList();
} }
@ -1171,7 +1171,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
if (queryList.Count() > 20) 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(); return queryList.OrderBy(x => x.Sort).ToList();
} }

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

Loading…
Cancel
Save