From e2a05a6c91f1b94bef8ecea7de7bf149d7e77c89 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期五, 18 十月 2024 15:05:29 +0800
Subject: [PATCH] 1

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/Utilities/ModelValidate.cs |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Utilities/ModelValidate.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Utilities/ModelValidate.cs"
index 1f75580..3d50266 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Utilities/ModelValidate.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Utilities/ModelValidate.cs"
@@ -32,6 +32,12 @@
             return SimpleValidate(propertyInfos, data);
         }
 
+        /// <summary>
+        /// 楠岃瘉瀹炰綋鍙傛暟
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="data"></param>
+        /// <returns></returns>
         public static (bool, string, object?) ValidateModelData<T>(List<T> datas) where T : class, new()
         {
             Type modelType = typeof(T);
@@ -162,15 +168,19 @@
                                 Type[] types = propertyInfo.PropertyType.GenericTypeArguments;
                                 if (types.Length == 1)
                                 {
-                                    string str = value.Serialize();
-                                    if (str == "[]")
+                                    if (tempValue.ChangeType(property.PropertyType).ToString() == propertyAttribute.NotNullAndEmptyWithPropertyAndValue[1].ChangeType(property.PropertyType).ToString())
                                     {
-                                        return (false, $"銆恵property.Name}銆戝睘鎬х殑鍊间负銆恵propertyAttribute.NotNullAndEmptyWithPropertyAndValue[1]}銆戞椂銆恵propertyInfo.Name}銆戝睘鎬х殑鍊间笉鍙负绌�", data);
+                                        string str = value.Serialize();
+                                        if (str == "[]")
+                                        {
+                                            return (false, $"銆恵property.Name}銆戝睘鎬х殑鍊间负銆恵propertyAttribute.NotNullAndEmptyWithPropertyAndValue[1]}銆戞椂銆恵propertyInfo.Name}銆戝睘鎬х殑鍊间笉鍙负绌�", data);
+                                        }
                                     }
+                                       
                                 }
                                 else if (types.Length == 0)
                                 {
-                                    if (tempValue.ChangeType(property.PropertyType) != propertyAttribute.NotNullAndEmptyWithPropertyAndValue[1].ChangeType(property.PropertyType) && value == null && string.IsNullOrEmpty(value.ToString()))
+                                    if (tempValue.ChangeType(property.PropertyType).ToString() == propertyAttribute.NotNullAndEmptyWithPropertyAndValue[1].ChangeType(property.PropertyType).ToString() && value == null && string.IsNullOrEmpty(value.ToString()))
                                     {
                                         return (false, $"銆恵property.Name}銆戝睘鎬х殑鍊间负銆恵propertyAttribute.NotNullAndEmptyWithPropertyAndValue[1]}銆戞椂銆恵propertyInfo.Name}銆戝睘鎬х殑鍊间笉鍙负绌�", data);
                                     }

--
Gitblit v1.9.3