Update query table

This commit is contained in:
sunkaixuan 2024-10-18 16:37:05 +08:00
parent 0179fef331
commit bc6eca7655
2 changed files with 19 additions and 1 deletions

View File

@ -372,9 +372,16 @@ namespace SqlSugar
} }
} }
else else
{
if (item.CSharpTypeName.EqualCase("nstring"))
{
inValue1 = ("(" + inArray.Select(it => it == "" ? "null" : it).Distinct().ToArray().ToJoinSqlInValsByVarchar() + ")");
}
else
{ {
inValue1 = ("(" + inArray.Select(it => it == "" ? "null" : it).Distinct().ToArray().ToJoinSqlInVals() + ")"); inValue1 = ("(" + inArray.Select(it => it == "" ? "null" : it).Distinct().ToArray().ToJoinSqlInVals() + ")");
} }
}
return inValue1; return inValue1;
} }

View File

@ -18,6 +18,17 @@ namespace SqlSugar
return string.Join(",", array.Where(c => c != null).Select(it => it.ToSqlValue())); return string.Join(",", array.Where(c => c != null).Select(it => it.ToSqlValue()));
} }
} }
public static string ToJoinSqlInValsByVarchar<T>(this T[] array)
{
if (array == null || array.Length == 0)
{
return ToSqlValue(string.Empty);
}
else
{
return string.Join(",", array.Where(c => c != null).Select(it => "N"+it.ToSqlValue()));
}
}
public static string ToJoinSqlInValsN<T>(this T[] array) public static string ToJoinSqlInValsN<T>(this T[] array)
{ {
if (array == null || array.Length == 0) if (array == null || array.Length == 0)