公共库返回数据

optimize
wet 2 years ago
parent cf32924be1
commit c301401e25

@ -114,6 +114,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
var list = await _sysCacheService.GetAllCodeCarrier();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.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)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -164,6 +168,10 @@ 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));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -215,6 +223,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
return list.Take(10);
}
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.OrderBy(x=>x.Sort).Take(10).ToList();
}
@ -267,6 +279,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -318,7 +334,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
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 (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -367,7 +386,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
List<CodeYard> list = await _sysCacheService.GetAllCodeYard();
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.OrderBy(x => x.Sort).ToList();
}
/// <summary>
@ -422,7 +444,10 @@ 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));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -475,7 +500,10 @@ 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.OrderBy(x => x.Sort).ToList();
}
/// <summary>
@ -529,7 +557,10 @@ 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));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -582,7 +613,9 @@ 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.OrderBy(x => x.Sort).ToList();
}
@ -637,7 +670,10 @@ 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));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -686,7 +722,10 @@ 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)
|| x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x=>x.Sort).ToList();
}
/// <summary>
@ -739,7 +778,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
.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));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -786,7 +828,10 @@ 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)
|| x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -841,7 +886,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
.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));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -890,7 +938,10 @@ 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)
|| x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)).OrderByDescending(x=>x.CreateTime);
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -957,7 +1008,10 @@ 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));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -1010,7 +1064,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|| x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
@ -1062,6 +1119,10 @@ 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));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}
/// <summary>
@ -1108,7 +1169,10 @@ 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));
if (queryList.Count() > 20)
{
return queryList.Take(10).OrderBy(x => x.Sort).ToList();
}
return queryList.OrderBy(x => x.Sort).ToList();
}

Loading…
Cancel
Save