1
hutongqing
2024-09-13 ea9bdf217e8202a5fa475262dba1792decb05bcb
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Core/Utilities/EntityProperties.cs
@@ -146,7 +146,7 @@
        /// <param name="removeNotContains">移除不存在字段</param>
        /// <param name="removerKey">移除主键</param>
        /// <returns></returns>
        public static string ValidateDicInEntity(this Type typeinfo, Dictionary<string, object> dic, bool removerKey, PropertyInfo[] propertyInfo, string[] ignoreFields = null)
        public static string ValidateDicInEntity(this Type typeinfo, Dictionary<string, object> dic, bool removerKey, PropertyInfo[] propertyInfo, string[]? ignoreFields = null)
        {
            if (dic == null || dic.Count == 0) { return "参数无效"; }
@@ -168,15 +168,23 @@
            foreach (PropertyInfo property in propertyInfo)
            {
                SugarColumn sugarColumn = property.GetCustomAttribute<SugarColumn>();
                SugarColumn? sugarColumn = property.GetCustomAttribute<SugarColumn>();
                if (sugarColumn == null)
                {
                    Navigate? navigate = property.GetCustomAttribute<Navigate>();
                    if(navigate != null)
                    {
                        continue;
                    }
                    return "请配置SugarColumn属性";
                }
                //忽略与主键的字段不做验证
                if (property.Name == keyName.FirstLetterToUpper() || (ignoreFields != null && ignoreFields.Contains(property.Name)) || sugarColumn.IsOnlyIgnoreInsert || sugarColumn.IsOnlyIgnoreUpdate || sugarColumn.IsIgnore)
                    continue;
                //不在编辑中的列,是否也要必填
                if (!dic.ContainsKey(property.Name.FirstLetterToLower()))
                if (!dic.ContainsKey(property.Name.FirstLetterToLower()) /*&& !dic.ContainsKey(property.Name.FirstLetterToUpper())*/)
                {
                    if (!sugarColumn.IsNullable)
                    {