查询时间

optimize
wet 2 years ago
parent 40b088cd29
commit cf45a93cbb

@ -491,13 +491,13 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
public async Task<dynamic> PortloadList([FromQuery] NameQueryDto input) public async Task<dynamic> PortloadList([FromQuery] NameQueryDto input)
{ {
List<CodePortLoad> list = await _sysCacheService.GetAllCodePortLoad(); List<CodePortLoad> list = await _sysCacheService.GetAllCodePortLoad();
_logger.LogInformation("起始港1:" + DateTime.Now.ToString()); _logger.LogInformation("起始港1:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.fff"));
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord), var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord),
x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || || x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) ||
x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) ||
x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)); x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
_logger.LogInformation("起始港2:" + DateTime.Now.ToString()); _logger.LogInformation("起始港2:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.fff"));
if (queryList.Count() > 20) if (queryList.Count() > 20)
{ {
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList(); return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
@ -615,8 +615,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
} }
else else
{ {
_logger.LogInformation("目的港1:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.fff"));
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));
_logger.LogInformation("目的港2:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.fff"));
if (queryList.Count() > 20) if (queryList.Count() > 20)
{ {
result = queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList(); result = queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();

Loading…
Cancel
Save