修改航线的查询问题

optimize
jianghaiqing 2 years ago
parent 1d9c10043b
commit 289ba48e2c

@ -1122,6 +1122,14 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
}
else
{
var model = _relaPortCarrierLaneRep.AsQueryable().Where(t => t.LaneCode == entity.LaneCode
&& t.Module == entity.Module
&& t.CarrierCode == entity.CarrierCode
&& t.PortCode == entity.PortCode).First();
if (model != null)
throw Oops.Bah(ErrorCode.D1006);
entity.GID = Guid.NewGuid().ToString();
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
@ -1148,7 +1156,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
//{
// throw Oops.Bah("参数过多,请传入模块查询");
//}
var queryList = list.Where(x => x.Module == input.Module)
var queryList = list
.WhereIF(!string.IsNullOrEmpty(input.Module), x => !string.IsNullOrWhiteSpace(x.Module) && x.Module.Equals(input.LaneCode, 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))

Loading…
Cancel
Save