diff --git a/Src/Asp.Net/SqlSugar/Abstract/ExecuteNavProvider/DeleteNavManyToMany.cs b/Src/Asp.Net/SqlSugar/Abstract/ExecuteNavProvider/DeleteNavManyToMany.cs index c68913a50..0b2438b60 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/ExecuteNavProvider/DeleteNavManyToMany.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/ExecuteNavProvider/DeleteNavManyToMany.cs @@ -40,7 +40,7 @@ namespace SqlSugar var childList = GetChildList().In(thisPkColumn.DbColumnName, bids).ToList(); - if (bids.Count != childList.Count) + if (_WhereList.HasValue()) { bids = childList.Select(it => thisPkColumn.PropertyInfo.GetValue(it)).ToList(); } @@ -55,9 +55,20 @@ namespace SqlSugar this._ParentPkColumn = thisPkColumn; this._IsDeletedParant = true; - SetContext(() => _Context.Deleteable().AS(mappingEntity.DbTableName).In( - mappingA.DbColumnName, aids - ).ExecuteCommand()); + + if (_WhereList.HasValue()) + { + SetContext(() => _Context.Deleteable().AS(mappingEntity.DbTableName) + .In(mappingA.DbColumnName, aids) + .In(mappingB.DbColumnName, bids) + .ExecuteCommand()); + } + else + { + SetContext(() => _Context.Deleteable().AS(mappingEntity.DbTableName).In( + mappingA.DbColumnName, aids + ).ExecuteCommand()); + } } diff --git a/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec b/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec index c22ed32aa..9b65aa0bc 100644 --- a/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec +++ b/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec @@ -2,7 +2,7 @@ SqlSugarCore - 5.0.9.5-preview03 + 5.0.9.5-preview04 sunkaixuan 果糖大数据科技 http://www.apache.org/licenses/LICENSE-2.0.html