From bdc6a6c9ac65dfad871ea65de4836f8e27b72427 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周日, 04 5月 2025 06:25:07 +0800
Subject: [PATCH] 22
---
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Attribute/NoAutoQueryAttribute.cs | 12
Weben_CMS专用代码生成器/CommonDLL/CmsQueryExtensions.dll | 0
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsMaterials/GetWmsMaterialsInput.cs | 124 +++++
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Domain/CMS.Plugin.HIAWms.Domain.csproj | 6
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/web/src/widgets/HIAWms/Views/Pages/WmsMaterial/WmsMaterial.tsx | 29
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Attribute/HighSearchRangeAttribute.cs | 11
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/PredicateExtensions/WhereHelper.cs | 177 ++++++++
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application.Contracts/CMS.Plugin.HIAWms.Application.Contracts.csproj | 6
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/WhereConditionsExtensions.cs | 248 +++++++++++
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/Repositories/EfCoreWmsMaterialRepository.cs | 29
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/CmsQueryExtensions.sln | 25 +
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application/CMS.Plugin.HIAWms.Application.csproj | 6
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsMaterialAppService.cs | 46 +
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/CMS.Plugin.HIAWms.EntityFrameworkCore.csproj | 6
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/SearchFilterModeEnum.cs | 17
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms/CMS.Plugin.HIAWms.csproj | 6
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/PredicateExtensions/ClassHelper.cs | 187 ++++++++
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/PredicateExtensions/PredicateExtensions.cs | 223 ++++++++++
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/FunReturnResultModel.cs | 47 ++
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/HighSearchModel.cs | 30 +
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Domain/WmsMaterials/IWmsMaterialRepository.cs | 6
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/CmsQueryExtensions.csproj | 9
Weben_CMS专用代码生成器/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/GlobalVars.cs | 35 +
23 files changed, 1,250 insertions(+), 35 deletions(-)
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/CommonDLL/CmsQueryExtensions.dll" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/CommonDLL/CmsQueryExtensions.dll"
new file mode 100644
index 0000000..2dca0bb
--- /dev/null
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/CommonDLL/CmsQueryExtensions.dll"
Binary files differ
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/CmsQueryExtensions.csproj" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/CmsQueryExtensions.csproj"
new file mode 100644
index 0000000..132c02c
--- /dev/null
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/CmsQueryExtensions.csproj"
@@ -0,0 +1,9 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFramework>net6.0</TargetFramework>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <Nullable>enable</Nullable>
+ </PropertyGroup>
+
+</Project>
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/CmsQueryExtensions.sln" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/CmsQueryExtensions.sln"
new file mode 100644
index 0000000..0080067
--- /dev/null
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/CmsQueryExtensions.sln"
@@ -0,0 +1,25 @@
+锘�
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.4.33213.308
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CmsQueryExtensions", "CmsQueryExtensions.csproj", "{D2B006DA-D473-4E98-A588-C1F52945A027}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {D2B006DA-D473-4E98-A588-C1F52945A027}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D2B006DA-D473-4E98-A588-C1F52945A027}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D2B006DA-D473-4E98-A588-C1F52945A027}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D2B006DA-D473-4E98-A588-C1F52945A027}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {912E75B5-EC51-46E7-B058-838F9373EC2E}
+ EndGlobalSection
+EndGlobal
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Attribute/HighSearchRangeAttribute.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Attribute/HighSearchRangeAttribute.cs"
new file mode 100644
index 0000000..49ffd12
--- /dev/null
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Attribute/HighSearchRangeAttribute.cs"
@@ -0,0 +1,11 @@
+锘縰sing System;
+
+namespace CmsQueryExtensions.Extension
+{
+ /// <summary>
+ /// 楂樼骇鏌ヨ鑼冨洿鏌ヨ鐗规��
+ /// </summary>
+ public class HighSearchRangeAttribute : Attribute
+ {
+ }
+}
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Attribute/NoAutoQueryAttribute.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Attribute/NoAutoQueryAttribute.cs"
new file mode 100644
index 0000000..3d8e3be
--- /dev/null
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Attribute/NoAutoQueryAttribute.cs"
@@ -0,0 +1,12 @@
+锘縰sing System;
+
+namespace CmsQueryExtensions.Extension
+{
+ /// <summary>
+ /// 涓嶈嚜鍔ㄦ煡璇㈢壒鎬�
+ /// 鐢ㄤ簬涓嶉渶瑕佽嚜鍔ㄥ垎瑙f煡璇㈢殑瀛楁
+ /// </summary>
+ public class NoAutoQueryAttribute : Attribute
+ {
+ }
+}
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/FunReturnResultModel.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/FunReturnResultModel.cs"
new file mode 100644
index 0000000..6cef195
--- /dev/null
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/FunReturnResultModel.cs"
@@ -0,0 +1,47 @@
+锘縩amespace CmsQueryExtensions.Extension
+{
+ /// <summary>
+ /// 鏂规硶杩斿洖瀹炰綋绫�
+ /// </summary>
+ public class FunReturnResultModel
+ {
+ public FunReturnResultModel()
+ {
+ this.IsSuccess = false;
+ }
+
+ /// <summary>
+ /// 鎵ц鏄惁鎴愬姛
+ /// </summary>
+ public bool IsSuccess { get; set; }
+
+ /// <summary>
+ /// 閿欒淇℃伅
+ /// </summary>
+ public string ErrMsg { get; set; }
+
+ }
+
+
+ /// <summary>
+ /// 鏂规硶杩斿洖瀹炰綋绫�
+ /// </summary>
+ public class FunReturnResultModel<T>
+ {
+ /// <summary>
+ /// 鎵ц鏄惁鎴愬姛
+ /// </summary>
+ public bool IsSuccess { get; set; }
+
+ /// <summary>
+ /// 閿欒淇℃伅
+ /// </summary>
+ public string ErrMsg { get; set; }
+
+ /// <summary>
+ /// 杩斿洖鏁版嵁
+ /// </summary>
+ public T data { get; set; }
+
+ }
+}
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/GlobalVars.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/GlobalVars.cs"
new file mode 100644
index 0000000..b86c7a5
--- /dev/null
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/GlobalVars.cs"
@@ -0,0 +1,35 @@
+锘縩amespace CmsQueryExtensions.Extension
+{
+ /// <summary>
+ /// 绯荤粺閫氱敤鐨勫父閲�
+ /// </summary>
+ public static class SystemCommonVar
+ {
+ /// <summary>
+ /// 閫氱敤鐨勬煡璇㈠瓧绗︿覆
+ /// </summary>
+ public const string searchVal = "searchVal";
+
+ /// <summary>
+ /// 楂樼骇鏌ヨ鐨勫悗缂�鍚�
+ /// </summary>
+ public const string highSearchModeSuffix = "_FilterMode";
+
+
+ /// <summary>
+ /// 閫氱敤鐨勬煡璇㈠瓧绗︿覆鐨勯厤缃ā寮�
+ /// </summary>
+ public const string searchVal_FilterMode = searchVal + highSearchModeSuffix;
+
+
+ /// <summary>
+ /// 瀛愭悳绱㈢粍浠朵紶閫掔殑灞炴�у悕
+ /// </summary>
+ public const string searchFormInputAttrs = "searchFormInputAttrs";
+
+ /// <summary>
+ /// 閫氱敤鐨勬煡璇㈠弬鏁扮被鐨勭埗绫讳腑鐨勫瓧娈�
+ /// </summary>
+ public const string commnParamFatherPros = "SortField|SortOrder|DescStr|PageNo|PageSize|page|pageSize|" + searchVal + "|" + searchVal_FilterMode + "|" + searchFormInputAttrs;
+ }
+}
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/HighSearchModel.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/HighSearchModel.cs"
new file mode 100644
index 0000000..9de0f8a
--- /dev/null
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/HighSearchModel.cs"
@@ -0,0 +1,30 @@
+锘縩amespace CmsQueryExtensions.Extension
+{
+ /// <summary>
+ /// 楂樼骇鏌ヨ瀹炰綋
+ /// </summary>
+ public class HighSearchModel
+ {
+ public string fieldName { get; set; }
+
+ public string fieldValue { get; set; }
+
+ /// <summary>
+ /// 绛涢�夋ā寮�
+ /// </summary>
+ public SearchFilterModeEnum filterMode { get; set; }
+ }
+
+ /// <summary>
+ /// 楂樼骇鏃ユ湡鑼冨洿鏌ヨ瀹炰綋
+ /// </summary>
+ public class HighSearchForDateTimeRangeModel
+ {
+ public string fieldName { get; set; }
+
+ public string start_fieldValue { get; set; }
+
+ public string end_fieldValue { get; set; }
+
+ }
+}
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/SearchFilterModeEnum.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/SearchFilterModeEnum.cs"
new file mode 100644
index 0000000..c4d06b2
--- /dev/null
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/Entity/SearchFilterModeEnum.cs"
@@ -0,0 +1,17 @@
+锘縩amespace CmsQueryExtensions.Extension
+{
+ /// <summary>
+ /// 閫氱敤鏌ヨ閰嶇疆妯″紡
+ /// </summary>
+ public enum SearchFilterModeEnum
+ {
+ 涓嶇瓫閫� = 0,
+ 妯$硦鏌ヨ = 1,
+ 绮惧噯鏌ヨ = 2,
+ 澶т簬绛変簬 = 3,
+ 灏忎簬绛変簬 = 4,
+ 澶т簬 = 5,
+ 灏忎簬 = 6,
+ 涓嶇瓑浜� = 7
+ }
+}
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/PredicateExtensions/ClassHelper.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/PredicateExtensions/ClassHelper.cs"
new file mode 100644
index 0000000..8035579
--- /dev/null
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/PredicateExtensions/ClassHelper.cs"
@@ -0,0 +1,187 @@
+锘縰sing System.Reflection;
+
+namespace CmsQueryExtensions.Extension
+{
+ /// <summary>
+ /// 绫诲府鍔�
+ /// </summary>
+ public class ClassHelper
+ {
+ /// <summary>
+ /// 瀹炰綋浜掕浆
+ /// </summary>
+ /// <typeparam name="T">鏂拌浆鎹㈢殑瀹炰綋</typeparam>
+ /// <typeparam name="S">瑕佽浆鎹㈢殑瀹炰綋</typeparam>
+ /// <param name="s"></param>
+ /// <returns></returns>
+ public static T RotationMapping<T, S>(S s)
+ {
+ T target = Activator.CreateInstance<T>();
+ var originalObj = s.GetType();
+ var targetObj = typeof(T);
+ foreach (PropertyInfo original in originalObj.GetProperties())
+ {
+ foreach (PropertyInfo t in targetObj.GetProperties())
+ {
+ if (t.Name == original.Name)
+ {
+ t.SetValue(target, original.GetValue(s, null), null);
+ }
+ }
+ }
+ return target;
+ }
+
+ /// <summary>
+ /// 鑾峰彇灞炴�у璞″垪琛�
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="t"></param>
+ /// <param name="proName"></param>
+ /// <param name="errMsg"></param>
+ /// <returns></returns>
+ public static PropertyInfo[] GetPropertyInfoList<T>(T t)
+ {
+ var pros = typeof(T).GetProperties();
+ return pros;
+ }
+
+ /// <summary>
+ /// 鑾峰彇灞炴�у璞�
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="t"></param>
+ /// <param name="proName"></param>
+ /// <param name="errMsg"></param>
+ /// <returns></returns>
+ public static PropertyInfo GetPropertyInfo<T>(T t, string proName, out string errMsg)
+ {
+ errMsg = "";
+ var pro = typeof(T).GetProperty(proName);
+ if (pro == null)
+ {
+ errMsg = "灞炴�у悕'" + proName + "'涓嶅瓨鍦ㄧ被'" + typeof(T).Name + "'涓�";
+ return null;
+ }
+ return pro;
+ }
+
+ /// <summary>
+ /// 鑾峰彇灞炴�х殑鍊�
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="t"></param>
+ /// <param name="proName"></param>
+ /// <param name="errMsg"></param>
+ /// <returns></returns>
+ public static string GetPropertyValue<T>(T t, string proName, out string errMsg)
+ {
+ var pro = GetPropertyInfo(t, proName, out errMsg);
+ if (!string.IsNullOrEmpty(errMsg))
+ {
+ return string.Empty;
+ }
+ var pro_value = pro.GetValue(t, null);
+ var str = pro_value == null ? string.Empty : Convert.ToString(pro_value);
+ return str;
+ }
+
+ /// <summary>
+ /// 鑾峰彇灞炴�х殑鍊�
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="t"></param>
+ /// <param name="proName"></param>
+ /// <param name="errMsg"></param>
+ /// <returns></returns>
+ public static object GetPropertyValueForReObject<T>(T t, string proName, out string errMsg)
+ {
+ var pro = GetPropertyInfo(t, proName, out errMsg);
+ if (!string.IsNullOrEmpty(errMsg))
+ {
+ return null;
+ }
+ var pro_value = pro.GetValue(t, null);
+ var str = pro_value == null ? null : (pro_value);
+ return str;
+ }
+
+
+ /// <summary>
+ /// 閫氳繃灞炴�у璞¤幏鍙栧睘鎬х殑鍊�
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="t"></param>
+ /// <param name="pro"></param>
+ /// <returns></returns>
+ public static string GetPropertyValueByObject<T>(T t, PropertyInfo pro)
+ {
+ var pro_value = pro.GetValue(t, null);
+ var str = pro_value == null ? string.Empty : Convert.ToString(pro_value);
+ return str;
+ }
+
+ /// <summary>
+ /// 閫氳繃灞炴�у璞¤幏鍙栧睘鎬х殑鍊�
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="t"></param>
+ /// <param name="pro"></param>
+ /// <returns></returns>
+ public static object GetPropertyValue<T>(T t, PropertyInfo pro)
+ {
+ var pro_value = pro.GetValue(t, null);
+ return pro_value;
+ }
+
+ /// <summary>
+ /// 鑾峰彇鐗规�с�愰珮绾ф煡璇㈣寖鍥存煡璇㈢壒鎬с��
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="t"></param>
+ /// <param name="pro"></param>
+ /// <returns></returns>
+ public static object[] GetHighSearchRangeAttributeByPro(PropertyInfo pro)
+ {
+ object[] Attributes = pro.GetCustomAttributes(typeof(HighSearchRangeAttribute), false);
+ return Attributes;
+ }
+
+ /// <summary>
+ /// 鑾峰彇鐗规�с�愪笉鑷姩鏌ヨ鐗规�с��
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="t"></param>
+ /// <param name="pro"></param>
+ /// <returns></returns>
+ public static bool IsExistNoAutoQueryAttribute(PropertyInfo pro)
+ {
+ object[] attributes = pro.GetCustomAttributes(typeof(NoAutoQueryAttribute), false);
+ if (attributes.Length > 0)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// 鑾峰彇灞炴�х殑鍊�
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="t"></param>
+ /// <param name="proName"></param>
+ /// <param name="errMsg"></param>
+ /// <returns></returns>
+ public static List<string> GetPropertyValueForList<T>(T t, string proName, out string errMsg)
+ {
+ var pro = GetPropertyInfo(t, proName, out errMsg);
+ if (!string.IsNullOrEmpty(errMsg))
+ {
+ return null;
+ }
+ var pro_value = pro.GetValue(t, null);
+ var list = pro_value == null ? null : (List<string>)pro_value;
+ return list;
+ }
+ }
+}
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/PredicateExtensions/PredicateExtensions.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/PredicateExtensions/PredicateExtensions.cs"
new file mode 100644
index 0000000..5240657
--- /dev/null
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/PredicateExtensions/PredicateExtensions.cs"
@@ -0,0 +1,223 @@
+锘縰sing System.Linq.Expressions;
+
+namespace CmsQueryExtensions.Extension
+{
+ internal class ParameterRebinder : ExpressionVisitor
+ {
+ private readonly Dictionary<ParameterExpression, ParameterExpression> map;
+ public ParameterRebinder(Dictionary<ParameterExpression, ParameterExpression> map)
+ {
+ this.map = map ?? new Dictionary<ParameterExpression, ParameterExpression>();
+ }
+ public static Expression ReplaceParameters(Dictionary<ParameterExpression, ParameterExpression> map, Expression exp)
+ {
+ return new ParameterRebinder(map).Visit(exp);
+ }
+ protected override Expression VisitParameter(ParameterExpression p)
+ {
+ ParameterExpression replacement;
+ if (map.TryGetValue(p, out replacement))
+ {
+ p = replacement;
+ }
+ return base.VisitParameter(p);
+ }
+ }
+
+ internal static class PredicateExtensions
+ {
+ public static Expression<Func<T, bool>> True<T>() { return f => true; }
+ public static Expression<Func<T, bool>> False<T>() { return f => false; }
+ public static Expression<T> Compose<T>(this Expression<T> first, Expression<T> second, Func<Expression, Expression, Expression> merge)
+ {
+ // build parameter map (from parameters of second to parameters of first)
+ var map = first.Parameters.Select((f, i) => new { f, s = second.Parameters[i] }).ToDictionary(p => p.s, p => p.f);
+
+ // replace parameters in the second lambda expression with parameters from the first
+ var secondBody = ParameterRebinder.ReplaceParameters(map, second.Body);
+
+ // apply composition of lambda expression bodies to parameters from the first expression
+ return Expression.Lambda<T>(merge(first.Body, secondBody), first.Parameters);
+ }
+
+ public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second)
+ {
+ return first.Compose(second, Expression.And);
+ }
+
+ public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second)
+ {
+ return first.Compose(second, Expression.Or);
+ }
+
+
+ /// <summary>
+ /// 鎷兼帴鎴� c.Name.contains("1111")||c.Name.Contains("2222")||c.Name.Contains("3333")) 褰㈠紡
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="options"></param>
+ /// <param name="fieldName"></param>
+ /// <returns></returns>
+ public static Expression<Func<T, bool>> GetConditionExpression<T>(string[] options, string fieldName)
+ {
+ ParameterExpression left = Expression.Parameter(typeof(T), "c");//c=>
+ Expression expression = Expression.Constant(false);
+ foreach (var optionName in options)
+ {
+ Expression right = Expression.Call
+ (
+ Expression.Property(left, typeof(T).GetProperty(fieldName)), //c.DataSourceName
+ typeof(string).GetMethod("Contains", new Type[] { typeof(string) }),// 鍙嶅皠浣跨敤.Contains()鏂规硶
+ Expression.Constant(optionName) // .Contains(optionName)
+ );
+ expression = Expression.Or(right, expression);//c.DataSourceName.contain("") || c.DataSourceName.contain("")
+ }
+ Expression<Func<T, bool>> finalExpression
+ = Expression.Lambda<Func<T, bool>>(expression, new ParameterExpression[] { left });
+ return finalExpression;
+ }
+
+ /// <summary>
+ /// (妯$硦鏌ヨ)鎷兼帴鎴� c.Name.contains("1111")||c.Code.Contains("1111")||c.Address.Contains("1111")) 褰㈠紡
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="options"></param>
+ /// <param name="fieldName"></param>
+ /// <returns></returns>
+ public static Expression<Func<T, bool>> GetConditionExpressionForFuzzyQuery<T>(string[] fieldNames, string fieldValue)
+ {
+ try
+ {
+ ParameterExpression left = Expression.Parameter(typeof(T), "c");//c=>
+ Expression expression = Expression.Constant(false);
+ foreach (var fieldName in fieldNames)
+ {
+ try
+ {
+ Expression right = Expression.Call
+ (
+ Expression.Property(left, typeof(T).GetProperty(fieldName)), //c.DataSourceName
+ typeof(string).GetMethod("Contains", new Type[] { typeof(string) }),// 鍙嶅皠浣跨敤.Contains()鏂规硶
+ Expression.Constant(fieldValue) // .Contains(fieldValue)
+ );
+ expression = Expression.Or(right, expression);//c.AAA.contain("") || c.BBB.contain("")
+ }
+ catch (Exception ex)
+ {
+ throw new Exception($"鍙傛暟{fieldName}鍖归厤鍏抽敭瀛楁煡璇㈡椂澶辫触:" + ex.Message);
+ }
+ }
+ Expression<Func<T, bool>> finalExpression
+ = Expression.Lambda<Func<T, bool>>(expression, new ParameterExpression[] { left });
+ return finalExpression;
+ }
+ catch (Exception)
+ {
+ throw;
+ }
+ }
+
+ /// <summary>
+ /// 锛堢簿鍑嗘煡璇級鎷兼帴鎴� c.Name.equals("1111")||c.Code.equals("1111")||c.Address.equals("1111")) 褰㈠紡
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="options"></param>
+ /// <param name="fieldName"></param>
+ /// <returns></returns>
+ public static Expression<Func<T, bool>> GetConditionExpressionForPreciseQuery<T>(string[] fieldNames, string fieldValue)
+ {
+ ParameterExpression left = Expression.Parameter(typeof(T), "c");//c=>
+ Expression expression = Expression.Constant(false);
+ foreach (var fieldName in fieldNames)
+ {
+ Expression right = Expression.Call
+ (
+ Expression.Property(left, typeof(T).GetProperty(fieldName)), //c.DataSourceName
+ typeof(string).GetMethod("Equals", new Type[] { typeof(string) }),// 鍙嶅皠浣跨敤.Equals()鏂规硶
+ Expression.Constant(fieldValue) // .Equals(fieldValue)
+ );
+ expression = Expression.Or(right, expression);//c.AAA.equals("") || c.BBB.equals("")
+ }
+ Expression<Func<T, bool>> finalExpression
+ = Expression.Lambda<Func<T, bool>>(expression, new ParameterExpression[] { left });
+ return finalExpression;
+ }
+
+
+ public static Expression<Func<T, bool>> GetConditionExpressionForHighFieldByAnd<T>(List<HighSearchModel> hsmList)
+ {
+ var whereHelper = new WhereHelper<T>();
+ foreach (var field in hsmList)
+ {
+ switch (field.filterMode)
+ {
+ case SearchFilterModeEnum.涓嶇瓑浜�:
+ whereHelper.NotEqual(field.fieldName, field.fieldValue);
+ break;
+ case SearchFilterModeEnum.澶т簬:
+ whereHelper.GreaterThan(field.fieldName, field.fieldValue);
+ break;
+ case SearchFilterModeEnum.澶т簬绛変簬:
+ whereHelper.GreaterThanOrEqual(field.fieldName, field.fieldValue);
+ break;
+ case SearchFilterModeEnum.灏忎簬:
+ whereHelper.LessThan(field.fieldName, field.fieldValue);
+ break;
+ case SearchFilterModeEnum.灏忎簬绛変簬:
+ whereHelper.LessThanOrEqual(field.fieldName, field.fieldValue);
+ break;
+ case SearchFilterModeEnum.妯$硦鏌ヨ:
+ whereHelper.Contains(field.fieldName, field.fieldValue);
+ break;
+ case SearchFilterModeEnum.绮惧噯鏌ヨ:
+ whereHelper.Equal(field.fieldName, field.fieldValue);
+ break;
+ }
+ }
+
+ Expression<Func<T, bool>> finalExpression
+ = Expression.Lambda<Func<T, bool>>(whereHelper.filter, new ParameterExpression[] { whereHelper.param });
+ return finalExpression;
+ }
+
+ public static Expression<Func<T, bool>> GetConditionExpressionForHighFieldByAnd<T>(List<HighSearchForDateTimeRangeModel> hsmForDatetimeList)
+ {
+ var whereHelper = new WhereHelper<T>();
+ foreach (var field in hsmForDatetimeList)
+ {
+ whereHelper.GreaterThanOrEqual(field.fieldName, field.start_fieldValue);
+ whereHelper.LessThanOrEqual(field.fieldName, field.end_fieldValue);
+ }
+ Expression<Func<T, bool>> finalExpression
+ = Expression.Lambda<Func<T, bool>>(whereHelper.filter, new ParameterExpression[] { whereHelper.param });
+ return finalExpression;
+ }
+
+ /// <summary>
+ /// 鏃ユ湡鑼冨洿OR杩炴帴
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="hsmForDatetimeList"></param>
+ /// <returns></returns>
+ public static Expression<Func<T, bool>> GetConditionExpressionForHighDateTimeRangeFieldByOr<T>(List<HighSearchForDateTimeRangeModel> hsmForDatetimeList)
+ {
+ Expression<Func<T, bool>> finalExpression = null;
+ var whereHelper = new WhereHelper<T>();
+ foreach (var field in hsmForDatetimeList)
+ {
+ whereHelper.GreaterThanOrEqual(field.fieldName, field.start_fieldValue);
+ whereHelper.LessThanOrEqual(field.fieldName, field.end_fieldValue);
+
+ finalExpression
+ = Expression.Lambda<Func<T, bool>>(whereHelper.filter, new ParameterExpression[] { whereHelper.param });
+
+ finalExpression = finalExpression.Or(finalExpression);
+ }
+
+ return finalExpression;
+ }
+ }
+
+
+
+}
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/PredicateExtensions/WhereHelper.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/PredicateExtensions/WhereHelper.cs"
new file mode 100644
index 0000000..eee8805
--- /dev/null
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/PredicateExtensions/WhereHelper.cs"
@@ -0,0 +1,177 @@
+锘縰sing System;
+using System.ComponentModel;
+using System.Linq.Expressions;
+using System.Reflection;
+
+namespace CmsQueryExtensions.Extension
+{
+ public class WhereHelper<T>
+
+ //where T : class
+
+ {
+
+ public ParameterExpression param;
+
+ public BinaryExpression filter;
+
+ private MemberExpression common_left;
+
+ private UnaryExpression common_right;
+
+ public WhereHelper()
+
+ {
+
+ param = Expression.Parameter(typeof(T), "c");//鏋勫缓 c=> 缁撴瀯
+
+ //1==1
+ Expression left = Expression.Constant(1);
+ filter = Expression.Equal(left, left);//鏋勫缓鍑� c=> 1=1
+
+ }
+
+ public Expression<Func<T, bool>> GetExpression()
+
+ {
+
+ return Expression.Lambda<Func<T, bool>>(filter, param);
+
+ }
+
+ private void CommonLeftRight(string propertyName, object value)
+ {
+
+ common_left = Expression.Property(param, typeof(T).GetProperty(propertyName));//鏋勫缓鏋勫缓c.{propertyName}鐨勭粨鏋�
+
+ var member = Expression.Property(param, propertyName);
+ var propertyType = ((PropertyInfo)member.Member).PropertyType;
+ var converter = TypeDescriptor.GetConverter(propertyType); // 1
+
+ if (!converter.CanConvertFrom(typeof(string))) // 2
+ throw new NotSupportedException();
+
+ var propertyValue = converter.ConvertFromInvariantString(value.ToString()); // 3
+ var constant = Expression.Constant(propertyValue);
+ common_right = Expression.Convert(constant, propertyType); // 4
+
+ // common_right = Expression.Constant(value, value.GetType());//鏋勫缓涓�涓父閲�,鍊兼槸 value
+ }
+
+ /// <summary>
+ /// 绛変簬 =
+ /// </summary>
+ /// <param name="propertyName"></param>
+ /// <param name="value"></param>
+ public void Equal(string propertyName, object value)
+ {
+ CommonLeftRight(propertyName, value);
+
+ Expression result = Expression.Equal(common_left, common_right);
+
+ filter = Expression.And(filter, result);
+ }
+
+ /// <summary>
+ /// 涓嶇瓑浜� <>
+ /// </summary>
+ /// <param name="propertyName"></param>
+ /// <param name="value"></param>
+ public void NotEqual(string propertyName, object value)
+ {
+
+ CommonLeftRight(propertyName, value);
+
+ Expression result = Expression.NotEqual(common_left, common_right);
+
+ filter = Expression.And(filter, result);
+
+ }
+
+ /// <summary>
+ /// 澶т簬 >
+ /// </summary>
+ /// <param name="propertyName"></param>
+ /// <param name="value"></param>
+ public void GreaterThan(string propertyName, object value)
+ {
+
+ CommonLeftRight(propertyName, value);
+
+ Expression result = Expression.GreaterThan(common_left, common_right);
+
+ filter = Expression.And(filter, result);
+
+ }
+
+ /// <summary>
+ /// 澶т簬绛変簬 >=
+ /// </summary>
+ /// <param name="propertyName"></param>
+ /// <param name="value"></param>
+ public void GreaterThanOrEqual(string propertyName, object value)
+ {
+
+ CommonLeftRight(propertyName, value);
+
+ Expression result = Expression.GreaterThanOrEqual(common_left, common_right);
+
+ filter = Expression.And(filter, result);
+
+ }
+
+ /// <summary>
+ /// 灏忎簬 <
+ /// </summary>
+ /// <param name="propertyName"></param>
+ /// <param name="value"></param>
+ public void LessThan(string propertyName, object value)
+ {
+
+ CommonLeftRight(propertyName, value);
+
+ Expression result = Expression.LessThan(common_left, common_right);
+
+ filter = Expression.And(filter, result);
+
+ }
+
+ /// <summary>
+ /// 灏忎簬绛変簬 <=
+ /// </summary>
+ /// <param name="propertyName"></param>
+ /// <param name="value"></param>
+ public void LessThanOrEqual(string propertyName, object value)
+ {
+
+ CommonLeftRight(propertyName, value);
+
+ Expression result = Expression.LessThanOrEqual(common_left, common_right);
+
+ filter = Expression.And(filter, result);
+
+ }
+
+ /// <summary>
+ /// 鍖呭惈 LIKE
+ /// </summary>
+ /// <param name="propertyName"></param>
+ /// <param name="value"></param>
+ public void Contains(string propertyName, string value)
+
+ {
+
+ Expression left = Expression.Property(param, typeof(T).GetProperty(propertyName));
+
+ Expression right = Expression.Constant(value, value.GetType());
+
+ Expression result = Expression.Call(left, typeof(string).GetMethod("Contains", new Type[] { typeof(string) }), right);
+
+ filter = Expression.And(filter, result);
+
+ }
+
+
+
+ }
+}
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/WhereConditionsExtensions.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/WhereConditionsExtensions.cs"
new file mode 100644
index 0000000..b6bf43d
--- /dev/null
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/queryExtensions/CmsQueryExtensions/Extension/DynamicSearchParameters/WhereConditionsExtensions.cs"
@@ -0,0 +1,248 @@
+锘縰sing System.Linq.Expressions;
+using System.Reflection;
+
+namespace CmsQueryExtensions.Extension
+{
+ /// <summary>
+ /// 鐢熸垚Where鏉′欢鎵╁睍
+ /// </summary>
+ public class WhereConditionsExtensions
+ {
+ public static FunReturnResultModel<Expression<Func<T, bool>>> GetWhereConditions<T, TParam>(TParam param)
+ {
+ FunReturnResultModel<Expression<Func<T, bool>>> result = new FunReturnResultModel<Expression<Func<T, bool>>>();
+ try
+ {
+ Expression<Func<T, bool>> conditions = PredicateExtensions.True<T>();
+
+ var errMsg = "";
+
+ #region 1銆侀�氱敤鏌ヨsearchVal
+
+ //鍒ゆ柇閫氱敤鏌ヨsearchVal
+ var pro_value_searchVal = ClassHelper.GetPropertyValue<TParam>(param, SystemCommonVar.searchVal, out errMsg);
+ if (!string.IsNullOrEmpty(errMsg))
+ {
+ result.IsSuccess = false;
+ result.ErrMsg = errMsg;
+ return result;
+ }
+ if (!string.IsNullOrEmpty(pro_value_searchVal))
+ {//琛ㄧず 閫氱敤鏌ヨsearchVal涓嶄负绌猴紝闇�瑕佹煡璇�
+ var pro_value_searchValMode = ClassHelper.GetPropertyValue<TParam>(param, SystemCommonVar.searchVal_FilterMode, out errMsg);
+ if (!string.IsNullOrEmpty(errMsg))
+ {
+ result.IsSuccess = false;
+ result.ErrMsg = errMsg;
+ return result;
+ }
+
+ var pro_value_searchFormInputAttrs = ClassHelper.GetPropertyValueForList<TParam>(param, SystemCommonVar.searchFormInputAttrs, out errMsg);
+ if (!string.IsNullOrEmpty(errMsg))
+ {
+ result.IsSuccess = false;
+ result.ErrMsg = errMsg;
+ return result;
+ }
+ if (pro_value_searchFormInputAttrs != null && pro_value_searchFormInputAttrs.Count > 0)
+ {
+ var i_pro_value_searchValMode = Convert.ToInt32(((SearchFilterModeEnum)Enum.Parse(typeof(SearchFilterModeEnum), pro_value_searchValMode)));
+ if (i_pro_value_searchValMode == Convert.ToInt32(SearchFilterModeEnum.妯$硦鏌ヨ))
+ {//妯$硦鏌ヨ
+ try
+ {
+ var new_conditions = PredicateExtensions.GetConditionExpressionForFuzzyQuery<T>(pro_value_searchFormInputAttrs.ToArray(), pro_value_searchVal);
+ conditions = conditions.And(new_conditions);
+ }
+ catch (Exception ex)
+ {
+ result.data = null;
+ result.IsSuccess = false;
+ result.ErrMsg = ex.Message;
+ return result;
+ }
+ }
+ else if (i_pro_value_searchValMode == Convert.ToInt32(SearchFilterModeEnum.绮惧噯鏌ヨ))
+ {//绮惧噯鏌ヨ
+ var new_conditions = PredicateExtensions.GetConditionExpressionForPreciseQuery<T>(pro_value_searchFormInputAttrs.ToArray(), pro_value_searchVal);
+ conditions = conditions.And(new_conditions);
+ /*
+ pro_value_searchFormInputAttrs.ForEach(x =>
+ {
+ if (!string.IsNullOrEmpty(x))
+ {
+ var myParam = Expression.Parameter(typeof(T));
+ var condition =
+Expression.Lambda<Func<T, bool>>(
+ Expression.Equal(
+ Expression.Property(myParam, x),
+ Expression.Constant(pro_value_searchVal, typeof(string))
+ ),
+ myParam
+); // for LINQ to SQl/Entities skip Compile() call
+ conditions = conditions.And(condition);
+
+ }
+
+ });
+ //*/
+ }
+ else
+ {
+ result.IsSuccess = false;
+ result.ErrMsg = "閫氱敤鏌ヨ閰嶇疆涓嶆纭�";
+ return result;
+ }
+ }
+ }
+
+ #endregion
+
+
+ #region 2銆侀珮绾ф煡璇�
+
+ var high_pros = FilterHigh_pros<TParam>(param);
+ List<HighSearchForDateTimeRangeModel> hsmForDatetimeList = new List<HighSearchForDateTimeRangeModel>();
+ List<HighSearchModel> hsmList = GetHighSearchModelList<TParam>(param, high_pros, ref hsmForDatetimeList);
+ if (hsmList.Count > 0)
+ {
+ var high_conditions = PredicateExtensions.GetConditionExpressionForHighFieldByAnd<T>(hsmList);
+ conditions = conditions.And(high_conditions);
+ }
+ if (hsmForDatetimeList.Count > 0)
+ {
+ var high_conditions = PredicateExtensions.GetConditionExpressionForHighFieldByAnd<T>(hsmForDatetimeList);
+ conditions = conditions.And(high_conditions);
+ }
+ #endregion
+
+
+ result.data = conditions;
+ result.IsSuccess = true;
+ return result;
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ }
+
+
+ /// <summary>
+ /// 杩囨护鎺塎ode鍚庣紑鐨勫睘鎬� 鍜屼竴浜涚壒娈婂睘鎬х殑锛屽DateTimeRange
+ /// </summary>
+ /// <typeparam name="TParam"></typeparam>
+ /// <param name="param"></param>
+ /// <param name="high_pros"></param>
+ /// <returns></returns>
+ private static List<HighSearchModel> GetHighSearchModelList<TParam>(TParam param, List<PropertyInfo> high_pros, ref List<HighSearchForDateTimeRangeModel> hsmForDatetimeList)
+ {
+ List<HighSearchModel> hsmList = new List<HighSearchModel>();
+ string errMsg = "";
+ SearchFilterModeEnum _svmEnum = default(SearchFilterModeEnum);
+ var hsmValue = "";
+ var pro_value = "";
+ foreach (var pro in high_pros)
+ {
+ if (!pro.Name.Contains(SystemCommonVar.highSearchModeSuffix))
+ {//涓嶆槸Mode鍚庣紑鐨勫瓧娈�
+ //鍒ゆ柇鏄笉鏄湁鐗规�х壒鎬х殑鍊�
+ var _highSearchRangeAttribute = ClassHelper.GetHighSearchRangeAttributeByPro(pro);
+ if (_highSearchRangeAttribute.Length > 0)
+ {
+ object v = ClassHelper.GetPropertyValue<TParam>(param, pro);
+ if (v == null)
+ {
+ continue;
+ }
+ List<string> arr_value = v as List<string>;
+ if (arr_value.Count < 2)
+ {
+ continue;
+ }
+ //string[] arr_value = (string[])v;
+ //string[] arr_value = Convert.ToString(v).Split(',');
+ hsmForDatetimeList.Add(new HighSearchForDateTimeRangeModel()
+ {
+ fieldName = pro.Name,
+ start_fieldValue = arr_value[0],
+ end_fieldValue = arr_value[1]
+ });
+ continue;
+ }
+
+ pro_value = ClassHelper.GetPropertyValueByObject<TParam>(param, pro);
+ if (string.IsNullOrEmpty(pro_value))
+ {
+ continue;
+ }
+
+ if (!ClassHelper.IsExistNoAutoQueryAttribute(pro))
+ {
+ //鏌ユ壘鏄浉搴擬ode鍚庣紑鐨勫瓧娈电殑鍊�
+ try
+ {
+ //淇鏌ヨ寮傚父bug 銆怑ditby shaocx,2025-05-03銆�
+ SearchFilterModeEnum? _svmEnum_obj = null;
+ _svmEnum_obj = (SearchFilterModeEnum?)ClassHelper.GetPropertyValueForReObject<TParam>(param, pro.Name + SystemCommonVar.highSearchModeSuffix, out errMsg);
+ if (_svmEnum_obj != null) { _svmEnum = _svmEnum_obj.Value; }
+ else
+ {
+ _svmEnum = SearchFilterModeEnum.涓嶇瓫閫�;
+ }
+ }
+ catch (Exception ex)
+ {
+ //澶勭悊寮傚父淇℃伅 銆怑ditby shaocx,2025-05-03銆�
+ _svmEnum = SearchFilterModeEnum.涓嶇瓫閫�;
+ }
+
+ //if (!string.IsNullOrEmpty(errMsg))
+ //{
+ // throw new Exception(errMsg);
+ //}
+ //if (hsmValue == "0" || string.IsNullOrEmpty(hsmValue))
+ //{
+ // continue;
+ //}
+ //_svmEnum = (SearchFilterModeEnum)Enum.Parse(typeof(SearchFilterModeEnum), hsmValue);
+ if (_svmEnum == SearchFilterModeEnum.涓嶇瓫閫�)
+ {
+ continue;
+ }
+ hsmList.Add(new HighSearchModel()
+ {
+ fieldName = pro.Name,
+ fieldValue = pro_value,
+ filterMode = _svmEnum
+ });
+ }
+ }
+ }
+ return hsmList;
+ }
+
+
+ /// <summary>
+ /// 杩囨护涓�浜涗笉闇�瑕佺殑瀛楁,濡侾age銆丳ageSize绛�
+ /// </summary>
+ /// <typeparam name="TParam"></typeparam>
+ /// <param name="param"></param>
+ /// <returns></returns>
+ private static List<PropertyInfo> FilterHigh_pros<TParam>(TParam param)
+ {
+ var all_high_pros = ClassHelper.GetPropertyInfoList<TParam>(param);
+ var high_pros = new List<PropertyInfo>();
+ //鎺掗櫎涓嶇敤鐨�
+ for (int i = 0; i < all_high_pros.Length; i++)
+ {
+ if (!SystemCommonVar.commnParamFatherPros.Contains(all_high_pros[i].Name))
+ {
+ high_pros.Add(all_high_pros[i]);
+ }
+ }
+ return high_pros;
+ }
+ }
+}
+
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application.Contracts/CMS.Plugin.HIAWms.Application.Contracts.csproj" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application.Contracts/CMS.Plugin.HIAWms.Application.Contracts.csproj"
index 8d63696..4b0028e 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application.Contracts/CMS.Plugin.HIAWms.Application.Contracts.csproj"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application.Contracts/CMS.Plugin.HIAWms.Application.Contracts.csproj"
@@ -18,4 +18,10 @@
<ProjectReference Include="..\CMS.Plugin.HIAWms.Domain.Shared\CMS.Plugin.HIAWms.Domain.Shared.csproj" />
</ItemGroup>
+ <ItemGroup>
+ <Reference Include="CmsQueryExtensions">
+ <HintPath>..\..\..\..\CommonDLL\CmsQueryExtensions.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+
</Project>
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsMaterials/GetWmsMaterialsInput.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsMaterials/GetWmsMaterialsInput.cs"
index 4a5d512..a72053f 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsMaterials/GetWmsMaterialsInput.cs"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application.Contracts/Dtos/WmsMaterials/GetWmsMaterialsInput.cs"
@@ -1,4 +1,5 @@
using CMS.Plugin.HIAWms.Domain.Shared.Enums;
+using CmsQueryExtensions.Extension;
using Volo.Abp.Application.Dtos;
namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsMaterials;
@@ -8,10 +9,45 @@
/// </summary>
public class GetWmsMaterialsInput : ExtensiblePagedAndSortedResultRequestDto
{
+ ///// <summary>
+ ///// Gets or sets the filter.
+ ///// </summary>
+ //public string Filter { get; set; }
+
+ #region 鍏抽敭瀛楁煡璇�
+
/// <summary>
- /// Gets or sets the filter.
+ /// 鍏抽敭瀛楁ā绯婃煡璇紙娉ㄦ剰鏄皬鍐欙紒锛�
/// </summary>
- public string Filter { get; set; }
+ public string searchVal { get; set; }
+
+ /// <summary>
+ /// 閫氱敤鏌ヨ閰嶇疆 (1:妯$硦鏌ヨ , 2:绮惧噯鏌ヨ)锛堟敞鎰忔槸灏忓啓锛侊級
+ /// </summary>
+ public SearchFilterModeEnum searchVal_FilterMode { get; set; } = SearchFilterModeEnum.妯$硦鏌ヨ;
+
+ /// <summary>
+ /// 瀛愭悳绱㈢粍浠朵紶閫掔殑閫氱敤鏌ヨ閰嶇疆鐨勫睘鎬у悕锛堟敞鎰忔槸灏忓啓锛侊級
+ /// </summary>
+ [NoAutoQuery]
+ public string str_searchFormInputAttrs { get; set; }
+ /// <summary>
+ /// 瀛愭悳绱㈢粍浠朵紶閫掔殑閫氱敤鏌ヨ閰嶇疆鐨勫睘鎬у悕锛堟敞鎰忔槸灏忓啓锛侊級
+ /// </summary>
+ public List<string> searchFormInputAttrs
+ {
+ get
+ {
+ if (!string.IsNullOrEmpty(str_searchFormInputAttrs))
+ {
+ return str_searchFormInputAttrs.Split(',').ToList();
+ }
+ return new List<string>();
+ }
+ }
+
+ #endregion
+
/// <summary>
/// Gets or sets the name.
@@ -31,12 +67,12 @@
/// <summary>
/// 閲囪喘绫诲瀷锛堟灇涓惧�硷級
/// </summary>
- public PurchaseTypeEnum PurchaseType { get; set; }
+ public PurchaseTypeEnum? PurchaseType { get; set; }
/// <summary>
/// 鐗╂枡绫诲瀷锛堟灇涓惧�硷級
/// </summary>
- public MaterialTypeEnum MaterialType { get; set; }
+ public MaterialTypeEnum? MaterialType { get; set; }
/// <summary>
/// 涓诲崟浣嶏紙濡傦細kg銆乵銆佷釜锛�
@@ -51,12 +87,12 @@
/// <summary>
/// 澶栧緞锛堝崟浣嶏細mm锛�
/// </summary>
- public decimal OuterDiameter { get; set; }
+ public decimal? OuterDiameter { get; set; }
/// <summary>
/// 澹佸帤锛堝崟浣嶏細mm锛�
/// </summary>
- public decimal WallThickness { get; set; }
+ public decimal? WallThickness { get; set; }
/// <summary>
/// 鏉愯川锛堝锛�304涓嶉攬閽級
@@ -66,12 +102,12 @@
/// <summary>
/// 闀垮害锛堝崟浣嶏細m锛�
/// </summary>
- public decimal Length { get; set; }
+ public decimal? Length { get; set; }
/// <summary>
/// 鏄惁涓轰富鏀锛坱rue: 涓绘敮绠�, false: 闈炰富鏀锛�
/// </summary>
- public YesNoEnum IsMainBranch { get; set; }
+ public YesNoEnum? IsMainBranch { get; set; }
/// <summary>
/// 鐢熶骇宸ュ巶
@@ -82,4 +118,76 @@
/// 璇佷功缂栧彿锛堝锛氬帇鍔涘鍣ㄨ璇侊級
/// </summary>
public string Certification { get; set; }
+
+ #region 鏌ヨ绛涢�夋潯浠�
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ public SearchFilterModeEnum Name_FilterMode { get; set; } = SearchFilterModeEnum.绮惧噯鏌ヨ;
+
+ /// <summary>
+ /// 鐗╂枡缂栫爜锛堝敮涓�鏍囪瘑锛�
+ /// </summary>
+ public SearchFilterModeEnum MaterialCode_FilterMode { get; set; } = SearchFilterModeEnum.妯$硦鏌ヨ;
+
+ /// <summary>
+ /// 鐗╂枡鍚嶇О
+ /// </summary>
+ public SearchFilterModeEnum MaterialName_FilterMode { get; set; } = SearchFilterModeEnum.妯$硦鏌ヨ;
+
+ /// <summary>
+ /// 閲囪喘绫诲瀷锛堟灇涓惧�硷級
+ /// </summary>
+ public SearchFilterModeEnum PurchaseType_FilterMode { get; set; } = SearchFilterModeEnum.妯$硦鏌ヨ;
+
+ /// <summary>
+ /// 鐗╂枡绫诲瀷锛堟灇涓惧�硷級
+ /// </summary>
+ public SearchFilterModeEnum MaterialType_FilterMode { get; set; } = SearchFilterModeEnum.妯$硦鏌ヨ;
+
+ /// <summary>
+ /// 涓诲崟浣嶏紙濡傦細kg銆乵銆佷釜锛�
+ /// </summary>
+ public SearchFilterModeEnum PrimaryUnit_FilterMode { get; set; } = SearchFilterModeEnum.妯$硦鏌ヨ;
+
+ /// <summary>
+ /// 瑙勬牸/鏍囧噯锛堝锛欸B/T 8163-2018锛�
+ /// </summary>
+ public SearchFilterModeEnum Standard_FilterMode { get; set; } = SearchFilterModeEnum.妯$硦鏌ヨ;
+
+ /// <summary>
+ /// 澶栧緞锛堝崟浣嶏細mm锛�
+ /// </summary>
+ public SearchFilterModeEnum OuterDiameter_FilterMode { get; set; } = SearchFilterModeEnum.妯$硦鏌ヨ;
+
+ /// <summary>
+ /// 澹佸帤锛堝崟浣嶏細mm锛�
+ /// </summary>
+ public SearchFilterModeEnum WallThickness_FilterMode { get; set; } = SearchFilterModeEnum.妯$硦鏌ヨ;
+
+ /// <summary>
+ /// 鏉愯川锛堝锛�304涓嶉攬閽級
+ /// </summary>
+ public SearchFilterModeEnum MaterialQuality_FilterMode { get; set; } = SearchFilterModeEnum.妯$硦鏌ヨ;
+
+ /// <summary>
+ /// 闀垮害锛堝崟浣嶏細m锛�
+ /// </summary>
+ public SearchFilterModeEnum Length_FilterMode { get; set; } = SearchFilterModeEnum.妯$硦鏌ヨ;
+
+ /// <summary>
+ /// 鏄惁涓轰富鏀锛坱rue: 涓绘敮绠�, false: 闈炰富鏀锛�
+ /// </summary>
+ public SearchFilterModeEnum IsMainBranch_FilterMode { get; set; } = SearchFilterModeEnum.妯$硦鏌ヨ;
+
+ /// <summary>
+ /// 鐢熶骇宸ュ巶
+ /// </summary>
+ public SearchFilterModeEnum Factory_FilterMode { get; set; } = SearchFilterModeEnum.妯$硦鏌ヨ;
+
+ /// <summary>
+ /// 璇佷功缂栧彿锛堝锛氬帇鍔涘鍣ㄨ璇侊級
+ /// </summary>
+ public SearchFilterModeEnum Certification_FilterMode { get; set; } = SearchFilterModeEnum.妯$硦鏌ヨ;
+ #endregion
}
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application/CMS.Plugin.HIAWms.Application.csproj" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application/CMS.Plugin.HIAWms.Application.csproj"
index b614f20..a934332 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application/CMS.Plugin.HIAWms.Application.csproj"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application/CMS.Plugin.HIAWms.Application.csproj"
@@ -18,4 +18,10 @@
<ProjectReference Include="..\CMS.Plugin.HIAWms.Domain\CMS.Plugin.HIAWms.Domain.csproj" />
</ItemGroup>
+ <ItemGroup>
+ <Reference Include="CmsQueryExtensions">
+ <HintPath>..\..\..\..\CommonDLL\CmsQueryExtensions.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+
</Project>
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsMaterialAppService.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsMaterialAppService.cs"
index c70214a..a9b0b6d 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsMaterialAppService.cs"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsMaterialAppService.cs"
@@ -4,6 +4,8 @@
using CMS.Plugin.HIAWms.Domain.Shared.Util;
using CMS.Plugin.HIAWms.Domain.Shared.WmsMaterials;
using CMS.Plugin.HIAWms.Domain.WmsMaterials;
+using CmsQueryExtensions.Extension;
+using System.Linq.Expressions;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Data;
@@ -42,15 +44,44 @@
input.Sorting = nameof(WmsMaterial.Sort);
}
+ #region 鍔ㄦ�佹瀯閫犳煡璇㈡潯浠�
+
+ //鍔ㄦ�佹瀯閫犳煡璇㈡潯浠�
+ var whereConditions = DynamicGetQueryParams(input);
+
+ #endregion
+
var specification = new WmsMaterialSpecification(input.Name);
var material = ObjectMapper.Map<GetWmsMaterialsInput, WmsMaterial>(input);
- var count = await _wmsmaterialRepository.GetCountAsync(material,input.Filter, specification);
+ var count = await _wmsmaterialRepository.GetCountAsync(material, whereConditions, specification);
- var list = await _wmsmaterialRepository.GetListAsync(material,input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter, specification);
+ var list = await _wmsmaterialRepository.GetListAsync(material, whereConditions,input.Sorting, input.MaxResultCount, input.SkipCount, specification);
return new PagedResultDto<WmsMaterialDto>(count, ObjectMapper.Map<List<WmsMaterial>, List<WmsMaterialDto>>(list));
}
+ /// <summary>
+ /// 鍔ㄦ�佹瀯閫犳煡璇㈡潯浠�
+ /// </summary>
+ /// <param name="input">杈撳叆鍙傛暟</param>
+ /// <returns></returns>
+ private FunReturnResultModel<Expression<Func<WmsMaterial, bool>>> DynamicGetQueryParams(GetWmsMaterialsInput input)
+ {
+ //鍔ㄦ�佹瀯閫犳煡璇㈡潯浠�
+ var whereConditions = WhereConditionsExtensions.GetWhereConditions<WmsMaterial, GetWmsMaterialsInput>(input);
+ if (!whereConditions.IsSuccess)
+ {
+ throw new Exception("鍔ㄦ�佹瀯閫犳煡璇㈡潯浠跺け璐�:" + whereConditions.ErrMsg);
+ }
+
+ //涔熷彲鍐嶆鑷畾涔夋瀯寤烘煡璇㈡潯浠�
+ Expression<Func<WmsMaterial, bool>> extendExpression = a => a.IsDeleted == false;
+ // 浣跨敤 System.Linq.PredicateBuilder 鐨� And
+ var pres = (System.Linq.Expressions.Expression<Func<WmsMaterial, bool>>)(whereConditions.data);
+ whereConditions.data = System.Linq.PredicateBuilder.And(pres, extendExpression);
+
+ return whereConditions;
+ }
/// <inheritdoc />
public virtual async Task<WmsMaterialDto> CreateAsync(WmsMaterialCreateDto input)
{
@@ -166,7 +197,7 @@
/// <inheritdoc />
public virtual async Task AdjustSortAsync(Guid id, int sort)
{
- var list = await _wmsmaterialRepository.GetListAsync(null, nameof(WmsMaterial.Sort));
+ var list = await _wmsmaterialRepository.GetListAsync(null,null, nameof(WmsMaterial.Sort));
if (list != null && list.Any())
{
var initSort = 1;
@@ -320,10 +351,17 @@
input.Sorting = nameof(WmsMaterial.Sort);
}
+ #region 鍔ㄦ�佹瀯閫犳煡璇㈡潯浠�
+
+ //鍔ㄦ�佹瀯閫犳煡璇㈡潯浠�
+ var whereConditions = DynamicGetQueryParams(input);
+
+ #endregion
+
var specification = new WmsMaterialSpecification(input.Name);
var material = ObjectMapper.Map<GetWmsMaterialsInput, WmsMaterial>(input);
- var list = await _wmsmaterialRepository.GetListAsync(material,input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter, specification, includeDetails: true);
+ var list = await _wmsmaterialRepository.GetListAsync(material, whereConditions,input.Sorting, input.MaxResultCount, input.SkipCount, specification, includeDetails: true);
var result = ObjectMapper.Map<List<WmsMaterial>, List<WmsMaterialDto>>(list);
var sheets = new Dictionary<string, object>
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Domain/CMS.Plugin.HIAWms.Domain.csproj" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Domain/CMS.Plugin.HIAWms.Domain.csproj"
index 0dd4b92..d6b4d7f 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Domain/CMS.Plugin.HIAWms.Domain.csproj"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Domain/CMS.Plugin.HIAWms.Domain.csproj"
@@ -18,4 +18,10 @@
<ProjectReference Include="..\CMS.Plugin.HIAWms.Domain.Shared\CMS.Plugin.HIAWms.Domain.Shared.csproj" />
</ItemGroup>
+ <ItemGroup>
+ <Reference Include="CmsQueryExtensions">
+ <HintPath>..\..\..\..\CommonDLL\CmsQueryExtensions.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+
</Project>
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Domain/WmsMaterials/IWmsMaterialRepository.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Domain/WmsMaterials/IWmsMaterialRepository.cs"
index e6b20f4..00228b5 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Domain/WmsMaterials/IWmsMaterialRepository.cs"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.Domain/WmsMaterials/IWmsMaterialRepository.cs"
@@ -1,3 +1,5 @@
+using CmsQueryExtensions.Extension;
+using System.Linq.Expressions;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Specifications;
@@ -41,7 +43,7 @@
/// <param name="includeDetails">if set to <c>true</c> [include details].</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
- Task<List<WmsMaterial>> GetListAsync(WmsMaterial material, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, Specification<WmsMaterial> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default);
+ Task<List<WmsMaterial>> GetListAsync(WmsMaterial material, FunReturnResultModel<Expression<Func<WmsMaterial, bool>>> whereConditions, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, Specification<WmsMaterial> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default);
/// <summary>
/// Gets the count asynchronous.
@@ -50,5 +52,5 @@
/// <param name="specification">The specification.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
- Task<long> GetCountAsync(WmsMaterial material, string filter = null, Specification<WmsMaterial> specification = null, CancellationToken cancellationToken = default);
+ Task<long> GetCountAsync(WmsMaterial material, FunReturnResultModel<Expression<Func<WmsMaterial, bool>>> whereConditions, Specification<WmsMaterial> specification = null, CancellationToken cancellationToken = default);
}
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/CMS.Plugin.HIAWms.EntityFrameworkCore.csproj" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/CMS.Plugin.HIAWms.EntityFrameworkCore.csproj"
index 8229450..41b8a24 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/CMS.Plugin.HIAWms.EntityFrameworkCore.csproj"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/CMS.Plugin.HIAWms.EntityFrameworkCore.csproj"
@@ -16,4 +16,10 @@
<ProjectReference Include="..\CMS.Plugin.HIAWms.Domain\CMS.Plugin.HIAWms.Domain.csproj" />
</ItemGroup>
+ <ItemGroup>
+ <Reference Include="CmsQueryExtensions">
+ <HintPath>..\..\..\..\CommonDLL\CmsQueryExtensions.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+
</Project>
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/Repositories/EfCoreWmsMaterialRepository.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/Repositories/EfCoreWmsMaterialRepository.cs"
index 72d311a..0bbd4c5 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/Repositories/EfCoreWmsMaterialRepository.cs"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms.EntityFrameworkCore/Repositories/EfCoreWmsMaterialRepository.cs"
@@ -4,10 +4,12 @@
using System.Linq.Expressions;
using CMS.Plugin.HIAWms.Domain.WmsMaterials;
using CMS.Plugin.HIAWms.EntityFrameworkCore.Extensions;
+using CmsQueryExtensions.Extension;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Specifications;
+
namespace CMS.Plugin.HIAWms.EntityFrameworkCore.Repositories;
@@ -55,17 +57,18 @@
}
/// <inheritdoc />
- public async Task<List<WmsMaterial>> GetListAsync(WmsMaterial? material, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, Specification<WmsMaterial> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default)
+ public async Task<List<WmsMaterial>> GetListAsync(WmsMaterial? material, FunReturnResultModel<Expression<Func<WmsMaterial, bool>>> whereConditions, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, Specification<WmsMaterial> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default)
{
specification ??= new WmsMaterialSpecification();
return await (await GetDbSetAsync())
.IncludeDetails(includeDetails)
.Where(specification.ToExpression())
- .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.MaterialCode.Contains(filter))
- .WhereIf(!string.IsNullOrEmpty(material.MaterialName), u => u.MaterialName.Contains(material.MaterialName))
- .WhereIf(!string.IsNullOrEmpty(material.MaterialCode), u => u.MaterialName.Contains(material.MaterialCode))
- .WhereIf(material.MaterialType > 0, u => u.MaterialType == material.MaterialType)
- .WhereIf(material.PurchaseType > 0, u => u.PurchaseType == material.PurchaseType)
+ .WhereIf(whereConditions != null, whereConditions.data)
+ //.WhereIf(!filter.IsNullOrWhiteSpace(), u => u.MaterialCode.Contains(filter))
+ //.WhereIf(!string.IsNullOrEmpty(material.MaterialName), u => u.MaterialName.Contains(material.MaterialName))
+ //.WhereIf(!string.IsNullOrEmpty(material.MaterialCode), u => u.MaterialName.Contains(material.MaterialCode))
+ //.WhereIf(material.MaterialType > 0, u => u.MaterialType == material.MaterialType)
+ //.WhereIf(material.PurchaseType > 0, u => u.PurchaseType == material.PurchaseType)
.Where(x => !x.IsDeleted)
.OrderBy(sorting.IsNullOrEmpty() ? nameof(WmsMaterial.Sort) : sorting)
.PageBy(skipCount, maxResultCount)
@@ -80,20 +83,22 @@
/// <param name="specification"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
- public async Task<long> GetCountAsync(WmsMaterial? material, string filter = null, Specification<WmsMaterial> specification = null, CancellationToken cancellationToken = default)
+ public async Task<long> GetCountAsync(WmsMaterial? material, FunReturnResultModel<Expression<Func<WmsMaterial, bool>>> whereConditions, Specification<WmsMaterial> specification = null, CancellationToken cancellationToken = default)
{
specification ??= new WmsMaterialSpecification();
return await (await GetQueryableAsync())
.Where(specification.ToExpression())
- .WhereIf(!string.IsNullOrEmpty(material.MaterialName), u => u.MaterialName.Contains(material.MaterialName))
- .WhereIf(!string.IsNullOrEmpty(material.MaterialCode), u => u.MaterialName.Contains(material.MaterialCode))
- .WhereIf(material.MaterialType > 0, u => u.MaterialType == material.MaterialType)
- .WhereIf(material.PurchaseType > 0, u => u.PurchaseType == material.PurchaseType)
+ .WhereIf(whereConditions != null, whereConditions.data)
+ //.WhereIf(!string.IsNullOrEmpty(material.MaterialName), u => u.MaterialName.Contains(material.MaterialName))
+ //.WhereIf(!string.IsNullOrEmpty(material.MaterialCode), u => u.MaterialName.Contains(material.MaterialCode))
+ //.WhereIf(material.MaterialType > 0, u => u.MaterialType == material.MaterialType)
+ //.WhereIf(material.PurchaseType > 0, u => u.PurchaseType == material.PurchaseType)
.Where(x => !x.IsDeleted)
- .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.MaterialCode.Contains(filter))
+ //.WhereIf(!filter.IsNullOrWhiteSpace(), u => u.MaterialCode.Contains(filter))
.CountAsync(cancellationToken: GetCancellationToken(cancellationToken));
}
+
/// <inheritdoc />
public override async Task<IQueryable<WmsMaterial>> WithDetailsAsync()
{
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms/CMS.Plugin.HIAWms.csproj" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms/CMS.Plugin.HIAWms.csproj"
index 3d96d8b..6b49128 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms/CMS.Plugin.HIAWms.csproj"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/server/src/CMS.Plugin.HIAWms/CMS.Plugin.HIAWms.csproj"
@@ -56,6 +56,12 @@
</ItemGroup>
<ItemGroup>
+ <Reference Include="CmsQueryExtensions">
+ <HintPath>..\..\..\..\CommonDLL\CmsQueryExtensions.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+
+ <ItemGroup>
<Resource Include="Flows\50001_1.pfd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/web/src/widgets/HIAWms/Views/Pages/WmsMaterial/WmsMaterial.tsx" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/web/src/widgets/HIAWms/Views/Pages/WmsMaterial/WmsMaterial.tsx"
index 46e1ac2..1703d1e 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/web/src/widgets/HIAWms/Views/Pages/WmsMaterial/WmsMaterial.tsx"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Weben_CMS_TemplateDemo/web/src/widgets/HIAWms/Views/Pages/WmsMaterial/WmsMaterial.tsx"
@@ -66,9 +66,16 @@
const wmsMaterialQueryDrawerRef=ref(null);
// 鏂板鐨勬煡璇㈡潯浠�
const queryForm = ref({
- filter: '',
+ searchVal: '',
+ str_searchFormInputAttrs:[]
})
-
+ //瀹氫箟鏁翠綋妯$硦鏌ヨ鐨勫垪鏁扮粍(娉ㄦ剰锛氬繀椤诲ぇ灏忓啓璺熷悗绔殑瀹炰綋绫诲睘鎬у悕涓�鑷达紝鍚﹀垯浼氬鑷村尮閰嶄笉瀵圭殑闂)
+ const _searchFormInputAttrs = ref([
+ 'MaterialCode',
+ 'MaterialName',
+ 'Remark'
+ ]);
+ const searchFormInputAttrs_Placeholder = ref('璇疯緭鍏ョ墿鏂欑紪鐮�/鐗╂枡鍚嶇О/澶囨敞');
// 鍔ㄦ�佹灇涓鹃�夐」
@@ -109,10 +116,11 @@
})
// 瀹氫箟鍝嶅簲寮忔煡璇㈡暟鎹�
- const _curHighQueryData = ref({ filter: '' });
+ const _curHighQueryData = ref({ searchVal: '',str_searchFormInputAttrs:[] });
// 鏂扮増鐨勬煡璇㈡柟娉曪紙涓婚〉闈腑鐨勬寜閽�愭煡璇€�戯級
const handleQueryForMain = async () => {
- _curHighQueryData.value.filter = queryForm.value.filter;
+ _curHighQueryData.value.searchVal = queryForm.value.searchVal;
+ _curHighQueryData.value.str_searchFormInputAttrs = _searchFormInputAttrs.value;
tableRef.value.getList(_curHighQueryData.value)
}
// 鏂扮増鐨勬煡璇㈡柟娉曪紙楂樼骇鏌ヨ涓殑鎸夐挳銆愭煡璇€�戯級
@@ -123,7 +131,8 @@
}
// 鏂扮増鐨勬煡璇㈤噸缃�
const resetQuery = () => {
- queryForm.value.filter = ''
+ queryForm.value.searchVal = ''
+ queryForm.value.str_searchFormInputAttrs=_searchFormInputAttrs.value;
}
//鏂扮増鐨勫鍑烘柟娉�
const handleExport=()=>{
@@ -139,7 +148,8 @@
//淇濆瓨鏌ヨ鍊�
const commonSaveCurHighQueryData=(filteredData={})=>{
_curHighQueryData.value = { ..._curHighQueryData.value, ...filteredData };
- _curHighQueryData.value.filter = queryForm.value.filter
+ _curHighQueryData.value.searchVal = queryForm.value.searchVal
+ _curHighQueryData.value.str_searchFormInputAttrs =_searchFormInputAttrs.value;
}
//鑾峰彇楂樼骇鏌ヨ寮瑰嚭妗嗙殑鏌ヨ鍊�
const commonGetHighQueryForm=(extraParams={})=>{
@@ -151,7 +161,8 @@
)
)
//缁勫悎妯$硦鏌ヨ
- filteredData.filter = queryForm.value.filter
+ filteredData.searchVal = queryForm.value.searchVal
+ filteredData.str_searchFormInputAttrs =_searchFormInputAttrs.value;
return filteredData;
}
@@ -274,8 +285,8 @@
<ElFormItem style={{ marginTop: '15px' }}>
<ElFormItem label="鍏抽敭瀛�">
<ElInput
- v-model={queryForm.value.filter}
- placeholder="璇疯緭鍏ュ叧閿瓧鎼滅储"
+ v-model={queryForm.value.searchVal}
+ placeholder={searchFormInputAttrs_Placeholder.value}
clearable
class={styles.formItem}
/>
--
Gitblit v1.9.3