From 46de9c4973fa79cfbf64abfb88340fb3c26008db Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Wed, 10 Aug 2022 15:24:14 +0800 Subject: [PATCH] Update .net core project --- .../SqlSugar/Entities/JoinInfoParameter.cs | 16 ++++++++++++++++ .../Json2Sql/Interface/ISugarQueryable.cs | 1 + .../Json2Sql/Queryable/QueryableProvider.cs | 11 +++++++++++ 3 files changed, 28 insertions(+) create mode 100644 Src/Asp.NetCore2/SqlSugar/Entities/JoinInfoParameter.cs 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}");