diff --git a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs index d3aa2efe7..9f6778ce3 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs @@ -443,7 +443,7 @@ namespace SqlSugar { ConditionalType = ConditionalType.Equal, FieldName = this.QueryBuilder.Builder.GetTranslationColumnName(column.DbColumnName), - FieldValue = value.ObjToString(), + FieldValue = value.ObjToStringNew(), CSharpTypeName = column.PropertyInfo.PropertyType.Name }); if (this.Context.CurrentConnectionConfig.DbType == DbType.PostgreSQL) diff --git a/Src/Asp.Net/SqlSugar/Utilities/UtilConvert.cs b/Src/Asp.Net/SqlSugar/Utilities/UtilConvert.cs index 1e535a2ea..42345a4b9 100644 --- a/Src/Asp.Net/SqlSugar/Utilities/UtilConvert.cs +++ b/Src/Asp.Net/SqlSugar/Utilities/UtilConvert.cs @@ -71,6 +71,15 @@ namespace SqlSugar if (thisValue != null) return thisValue.ToString().Trim(); return ""; } + public static string ObjToStringNew(this object thisValue) + { + if (thisValue != null && thisValue is byte[]) + { + return string.Join("|",thisValue as byte[]); + } + if (thisValue != null) return thisValue.ToString().Trim(); + return ""; + } public static string ObjToString(this object thisValue, string errorValue) { diff --git a/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs b/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs index 987363c16..ee08af296 100644 --- a/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs +++ b/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs @@ -557,7 +557,7 @@ namespace SqlSugar { return Convert.ToInt32(item.FieldValue); } - else if (item.CSharpTypeName .EqualCase("long")) + else if (item.CSharpTypeName.EqualCase("long")) { return Convert.ToInt64(item.FieldValue); } @@ -569,11 +569,11 @@ namespace SqlSugar { return Convert.ToByte(item.FieldValue); } - else if (item.CSharpTypeName.EqualCase( "uint")) + else if (item.CSharpTypeName.EqualCase("uint")) { return Convert.ToUInt32(item.FieldValue); } - else if (item.CSharpTypeName.EqualCase( "ulong")) + else if (item.CSharpTypeName.EqualCase("ulong")) { return Convert.ToUInt64(item.FieldValue); } @@ -581,11 +581,11 @@ namespace SqlSugar { return Convert.ToUInt16(item.FieldValue); } - else if (item.CSharpTypeName.EqualCase( "uint32")) + else if (item.CSharpTypeName.EqualCase("uint32")) { return Convert.ToUInt32(item.FieldValue); } - else if (item.CSharpTypeName.EqualCase( "uint64")) + else if (item.CSharpTypeName.EqualCase("uint64")) { return Convert.ToUInt64(item.FieldValue); } @@ -593,6 +593,10 @@ namespace SqlSugar { return Convert.ToUInt16(item.FieldValue); } + else if (item.CSharpTypeName.EqualCase("byte[]")&&item.FieldValue!=null&&item.FieldValue.Contains("|")) + { + return item.FieldValue.Split('|').Select(it=>Convert.ToByte(it)).ToArray(); + } else { return item.FieldValue;