From 2c4e9a9c6c5783d4f0c04161ebda3a2994de512d Mon Sep 17 00:00:00 2001 From: jxx <283591387@qq.com> Date: Fri, 3 Feb 2023 18:58:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0or=E6=9F=A5=E8=AF=A2=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Sell/Partial/SellOrderService.cs | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/Vue.Net/VOL.Order/Services/Sell/Partial/SellOrderService.cs b/Vue.Net/VOL.Order/Services/Sell/Partial/SellOrderService.cs index fea2f790..e2691f76 100644 --- a/Vue.Net/VOL.Order/Services/Sell/Partial/SellOrderService.cs +++ b/Vue.Net/VOL.Order/Services/Sell/Partial/SellOrderService.cs @@ -42,6 +42,87 @@ namespace VOL.Order.Services //如果只需要对某个功能生效,如编辑,则在重写编辑方法中设置 IsMultiTenancy = true; // IsMultiTenancy = true; } + + + ///// + ///// 2023.02.03增加or查询条件示例 + ///// 注意:如果有导出功能,GetPageData方法内的代码在下面的export方法里需要同样的复制一份 + ///// + ///// + ///// + //public override PageGridData GetPageData(PageDataOptions options) + //{ + // Expression> orFilter = null; + // QueryRelativeList = (List parameters) => + // { + // //方式1:动态生成or查询条件 + // foreach (var item in parameters) + // { + // if (!string.IsNullOrEmpty(item.Value)) + // { + // //注意:这里只需要判断or查询的字段,其他的字段不需要处理 + // //这里必须拷贝value值 + // string value = item.Value; + // if (item.Name == "TranNo") + // { + // //进行or模糊查询 + // orFilter = orFilter.Or(x => x.TranNo.Contains(value)); + // //清空原来的数据 + // item.Value = null; + // } + // else if (item.Name == "SellNo") + // { + // //进行or等于查询 + // orFilter = orFilter.Or(x => x.SellNo == value); + // //清空原来的数据 + // item.Value = null; + // } + // } + // } + + // QueryRelativeExpression = (IQueryable queryable) => + // { + // if (orFilter != null) + // { + // queryable = queryable.Where(orFilter); + // } + // return queryable; + // }; + + + // ///方式2:原生sql查询,需要自己处理sql注入问题(不建议使用此方法) + // //string sql = null; + // //foreach (var item in parameters) + // //{ + // // if (!string.IsNullOrEmpty(item.Value)) + // // { + // // if (sql == null) + // // { + // // sql = "where 1=2"; + // // } + // // string value = item.Value; + // // //清空原来的数据 + // // item.Value = null; + // // if (item.Name == "TranNo") + // // { + // // sql += $" or TranNo='{value}'"; + // // //清空原来的数据 + // // item.Value = null; + // // } + // // else if (item.Name == "SellNo") + // // { + // // sql += $" or SellNo='{value}'"; + // // } + // // } + // //} + // //QuerySql = "select * from sellorder " + sql; + // }; + + + // return base.GetPageData(options); + //} + + //查询 public override PageGridData GetPageData(PageDataOptions options) {