Browse Source

Where(ConditionalModels) byte array bug

pull/18/MERGE
sunkaixuan 3 years ago
parent
commit
b196b53d8b
  1. 2
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs
  2. 9
      Src/Asp.Net/SqlSugar/Utilities/UtilConvert.cs
  3. 4
      Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs

2
Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs

@ -443,7 +443,7 @@ namespace SqlSugar
{ {
ConditionalType = ConditionalType.Equal, ConditionalType = ConditionalType.Equal,
FieldName = this.QueryBuilder.Builder.GetTranslationColumnName(column.DbColumnName), FieldName = this.QueryBuilder.Builder.GetTranslationColumnName(column.DbColumnName),
FieldValue = value.ObjToString(), FieldValue = value.ObjToStringNew(),
CSharpTypeName = column.PropertyInfo.PropertyType.Name CSharpTypeName = column.PropertyInfo.PropertyType.Name
}); });
if (this.Context.CurrentConnectionConfig.DbType == DbType.PostgreSQL) if (this.Context.CurrentConnectionConfig.DbType == DbType.PostgreSQL)

9
Src/Asp.Net/SqlSugar/Utilities/UtilConvert.cs

@ -71,6 +71,15 @@ namespace SqlSugar
if (thisValue != null) return thisValue.ToString().Trim(); if (thisValue != null) return thisValue.ToString().Trim();
return ""; 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) public static string ObjToString(this object thisValue, string errorValue)
{ {

4
Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs

@ -593,6 +593,10 @@ namespace SqlSugar
{ {
return Convert.ToUInt16(item.FieldValue); 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 else
{ {
return item.FieldValue; return item.FieldValue;

Loading…
Cancel
Save