diff --git a/Myshipping.Core/Service/CommonDB/CommonDBService.cs b/Myshipping.Core/Service/CommonDB/CommonDBService.cs index 95d0f449..b0e57439 100644 --- a/Myshipping.Core/Service/CommonDB/CommonDBService.cs +++ b/Myshipping.Core/Service/CommonDB/CommonDBService.cs @@ -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(); } diff --git a/Myshipping.Core/Service/CommonDB/Dto/QueryDto.cs b/Myshipping.Core/Service/CommonDB/Dto/QueryDto.cs index aedd85d5..c791d4b0 100644 --- a/Myshipping.Core/Service/CommonDB/Dto/QueryDto.cs +++ b/Myshipping.Core/Service/CommonDB/Dto/QueryDto.cs @@ -12,11 +12,14 @@ namespace Myshipping.Core.Service //KeyWord public class NameQueryDto { - + /// /// 关键字 /// public string KeyWord { get; set; } + + + public int Limit { get; set; } = 10; } public class MappingQueryDto @@ -32,6 +35,8 @@ namespace Myshipping.Core.Service /// 关键字 /// public string KeyWord { get; set; } + + public int Limit { get; set; } = 10; } }