db.Queryable.AddJoinInfo(+3)

This commit is contained in:
sunkaixuan 2023-09-11 13:43:39 +08:00
parent 426c4b2003
commit dd10f26612
2 changed files with 17 additions and 1 deletions

View File

@ -571,7 +571,22 @@ namespace SqlSugar
QueryBuilder.Parameters.Add(parameter);
return this;
}
public ISugarQueryable<T> AddJoinInfo(Type JoinType, string shortName, string joinWhere, JoinType type = JoinType.Left)
{
var tableName = this.Context.EntityMaintenance.GetEntityInfo(JoinType).DbTableName;
QueryBuilder.JoinIndex = +1;
QueryBuilder.JoinQueryInfos
.Add(new JoinQueryInfo()
{
JoinIndex = QueryBuilder.JoinIndex,
TableName = tableName,
ShortName = shortName,
JoinType = type,
JoinWhere = joinWhere,
EntityType=JoinType
});
return this;
}
public virtual ISugarQueryable<T> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type = JoinType.Left)
{

View File

@ -62,6 +62,7 @@ namespace SqlSugar
ISugarQueryable<T> AddParameters(SugarParameter[] parameters);
ISugarQueryable<T> AddParameters(List<SugarParameter> parameters);
ISugarQueryable<T> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type = JoinType.Left);
ISugarQueryable<T> AddJoinInfo(Type JoinType, string shortName, string joinWhere, JoinType type = JoinType.Left);
/// <summary>
/// if a property that is not empty is a condition