修改国家的查询方法。

optimize
jianghaiqing 2 years ago
parent e213bf8253
commit 1d9c10043b

@ -1081,10 +1081,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
List<CodeLane> list = await _sysCacheService.GetAllCodeLane();
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.LaneType.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
x => (!string.IsNullOrWhiteSpace(x.Code) && x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|| (!string.IsNullOrWhiteSpace(x.EnName) && x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|| (!string.IsNullOrWhiteSpace(x.CnName) && x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|| (!string.IsNullOrWhiteSpace(x.LaneType) && x.LaneType.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
);
@ -1149,10 +1149,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
// throw Oops.Bah("参数过多,请传入模块查询");
//}
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.LaneCode), x => x.LaneCode.Contains(input.LaneCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => x.CarrierCode.Contains(input.CarrierCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.PortCode), x => x.PortCode.Contains(input.PortCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module.Contains(input.Module, System.StringComparison.CurrentCultureIgnoreCase));
.WhereIF(!string.IsNullOrEmpty(input.LaneCode), x => !string.IsNullOrWhiteSpace(x.LaneCode) && x.LaneCode.Contains(input.LaneCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => !string.IsNullOrWhiteSpace(x.CarrierCode) && x.CarrierCode.Contains(input.CarrierCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.PortCode), x => !string.IsNullOrWhiteSpace(x.PortCode) && x.PortCode.Contains(input.PortCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.Module), x => !string.IsNullOrWhiteSpace(x.Module) && x.Module.Contains(input.Module, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
}
#endregion
@ -1221,11 +1221,11 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
List<CodeCountry> list = await _sysCacheService.GetAllCodeCountry();
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.Capital.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.Continent.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
x => (!string.IsNullOrWhiteSpace(x.Code) && x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|| (!string.IsNullOrWhiteSpace(x.EnName) && x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|| (!string.IsNullOrWhiteSpace(x.CnName) && x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|| (!string.IsNullOrWhiteSpace(x.Capital) && x.Capital.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|| (!string.IsNullOrWhiteSpace(x.Continent) && x.Continent.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
);
return queryList.ToList();

Loading…
Cancel
Save