diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableHelper.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableHelper.cs index 0ee3ec5c9..1c96b2dcb 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableHelper.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableHelper.cs @@ -1534,15 +1534,18 @@ namespace SqlSugar foreach (var item in result) { var setValue = Activator.CreateInstance(itemProperty.PropertyType, true) as IList; - var appindex = 0; - foreach (var appValue in appendValue) + if (appendValue != null) { - if (appValue[0].Value.ObjToInt() == resIndex) + var appindex = 0; + foreach (var appValue in appendValue) { - var addItem = list[appindex]; - setValue.Add(addItem); + if (appValue[0].Value.ObjToInt() == resIndex) + { + var addItem = list[appindex]; + setValue.Add(addItem); + } + appindex++; } - appindex++; } itemProperty.SetValue(item, setValue); resIndex++; diff --git a/Src/Asp.NetCore2/SqlSugar/Realization/PostgreSQL/SqlBuilder/PostgreSQLQueryBuilder.cs b/Src/Asp.NetCore2/SqlSugar/Realization/PostgreSQL/SqlBuilder/PostgreSQLQueryBuilder.cs index 3c5f64c12..36e43d33c 100644 --- a/Src/Asp.NetCore2/SqlSugar/Realization/PostgreSQL/SqlBuilder/PostgreSQLQueryBuilder.cs +++ b/Src/Asp.NetCore2/SqlSugar/Realization/PostgreSQL/SqlBuilder/PostgreSQLQueryBuilder.cs @@ -108,6 +108,10 @@ namespace SqlSugar { result = "distinct "+result; } + if (this.SubToListParameters != null && this.SubToListParameters.Any()) + { + result = SubToListMethod(result); + } return result; } }