Update ado in

This commit is contained in:
sunkaixuan 2023-04-26 18:46:22 +08:00
parent 2a221258b1
commit 5ec247ee8d
2 changed files with 30 additions and 2 deletions

View File

@ -1625,6 +1625,15 @@ namespace SqlSugar
{
sql = sql.Replace(this.SqlParameterKeyWord + item.ParameterName, newValues.ToArray().ToJoinSqlInVals());
}
else if (item.Value!=null&&UtilMethods.IsNumberArray(item.Value.GetType()))
{
if (newValues.Any(it => it == ""))
{
newValues.RemoveAll(r => r == "");
newValues.Add("null");
}
sql = sql.Replace(item.ParameterName, string.Join(",", newValues));
}
else
{
sql = sql.Replace(item.ParameterName, newValues.ToArray().ToJoinSqlInVals());
@ -1641,6 +1650,9 @@ namespace SqlSugar
}
}
}
private List<TResult> GetData<TResult>(Type entityType, IDataReader dataReader)
{
List<TResult> result;

View File

@ -17,6 +17,22 @@ namespace SqlSugar
{
public class UtilMethods
{
internal static bool IsNumberArray(Type type)
{
return type.IsIn(typeof(int[]),
typeof(long[]),
typeof(short[]),
typeof(uint[]),
typeof(ulong[]),
typeof(ushort[]),
typeof(int?[]),
typeof(long?[]),
typeof(short?[]),
typeof(uint?[]),
typeof(ulong?[]),
typeof(ushort?[]));
}
public static string GetNativeSql(string sql,SugarParameter[] pars)
{
if (pars == null||pars.Length==0)