diff --git a/Src/Asp.NetCore2/SqlSugar/Entities/JoinInfoParameter.cs b/Src/Asp.NetCore2/SqlSugar/Entities/JoinInfoParameter.cs new file mode 100644 index 000000000..830ddd7c0 --- /dev/null +++ b/Src/Asp.NetCore2/SqlSugar/Entities/JoinInfoParameter.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SqlSugar +{ + public class JoinInfoParameter + { + public string TableName { get; set; } + public string ShortName{ get; set; } + public IFuncModel Models { get; set; } + public JoinType Type { get; set; } + } +} diff --git a/Src/Asp.NetCore2/SqlSugar/Json2Sql/Interface/ISugarQueryable.cs b/Src/Asp.NetCore2/SqlSugar/Json2Sql/Interface/ISugarQueryable.cs index 61995be57..12a4f9116 100644 --- a/Src/Asp.NetCore2/SqlSugar/Json2Sql/Interface/ISugarQueryable.cs +++ b/Src/Asp.NetCore2/SqlSugar/Json2Sql/Interface/ISugarQueryable.cs @@ -12,5 +12,6 @@ namespace SqlSugar ISugarQueryable Select(List models); ISugarQueryable AS(string tableName, string shortName); ISugarQueryable AddJoinInfo(string tableName, string shortName, IFuncModel models, JoinType type = JoinType.Left); + ISugarQueryable AddJoinInfo(List joinInfoParameters); } } diff --git a/Src/Asp.NetCore2/SqlSugar/Json2Sql/Queryable/QueryableProvider.cs b/Src/Asp.NetCore2/SqlSugar/Json2Sql/Queryable/QueryableProvider.cs index 36c0b5f00..3ed7da1d8 100644 --- a/Src/Asp.NetCore2/SqlSugar/Json2Sql/Queryable/QueryableProvider.cs +++ b/Src/Asp.NetCore2/SqlSugar/Json2Sql/Queryable/QueryableProvider.cs @@ -13,6 +13,17 @@ namespace SqlSugar this.QueryBuilder.Parameters.AddRange(sqlobj.Value); return this.AddJoinInfo(tableName, shortName, sqlobj.Key, type); } + public ISugarQueryable AddJoinInfo(List joinInfoParameters) + { + if (joinInfoParameters != null) + { + foreach (var item in joinInfoParameters) + { + this.AddJoinInfo(item.TableName,item.ShortName,item.Models,item.Type); + } + } + return this; + } public ISugarQueryable AS(string tableName, string shortName) { return this.AS($"{this.SqlBuilder.GetTranslationTableName(tableName)} {shortName}");