|
|
@ -11,13 +11,42 @@ namespace SqlSugar |
|
|
|
public SqlSugarProvider Context { get; internal set; } |
|
|
|
public Type EntityType { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
#region Json 2 sql api
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region Sql API
|
|
|
|
public QueryMethodInfo AS(string tableName) |
|
|
|
{ |
|
|
|
string shortName = $"{tableName}_1"; |
|
|
|
var method = QueryableObj.GetType().GetMyMethod("AS", 2, typeof(string), typeof(string)); |
|
|
|
this.QueryableObj = method.Invoke(QueryableObj, new object[] { tableName, shortName }); |
|
|
|
return this; |
|
|
|
} |
|
|
|
public QueryMethodInfo AS(string tableName, string shortName) |
|
|
|
{ |
|
|
|
var method = QueryableObj.GetType().GetMyMethod("AS", 2, typeof(string), typeof(string)); |
|
|
|
this.QueryableObj = method.Invoke(QueryableObj, new object[] { tableName, shortName }); |
|
|
|
return this; |
|
|
|
} |
|
|
|
public QueryMethodInfo OrderBy(string orderBySql) |
|
|
|
{ |
|
|
|
var method = QueryableObj.GetType().GetMyMethod("OrderBy", 1, typeof(string)); |
|
|
|
this.QueryableObj = method.Invoke(QueryableObj, new object[] { orderBySql }); |
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
|
|
public QueryMethodInfo AddJoinInfo(string tableName, string shortName,string onWhere, JoinType type = JoinType.Left) |
|
|
|
{ |
|
|
|
var method = QueryableObj.GetType().GetMyMethod("AddJoinInfo", 4, typeof(string),typeof(string),typeof(string),typeof(JoinType)); |
|
|
|
this.QueryableObj = method.Invoke(QueryableObj, new object[] { tableName,shortName,onWhere,type }); |
|
|
|
return this; |
|
|
|
} |
|
|
|
public QueryMethodInfo AddJoinInfo(Type joinEntityType, string shortName, string onWhere, JoinType type = JoinType.Left) |
|
|
|
{ |
|
|
|
var method = QueryableObj.GetType().GetMyMethod("AddJoinInfo", 4, typeof(string), typeof(string), typeof(string), typeof(JoinType)); |
|
|
|
this.QueryableObj = method.Invoke(QueryableObj, new object[] { this.Context.EntityMaintenance.GetTableName(joinEntityType), shortName, onWhere, type }); |
|
|
|
return this; |
|
|
|
} |
|
|
|
public QueryMethodInfo GroupBy(string groupBySql) |
|
|
|
{ |
|
|
|
var method = QueryableObj.GetType().GetMyMethod("GroupBy", 1, typeof(string)); |
|
|
@ -71,6 +100,8 @@ namespace SqlSugar |
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region Result
|
|
|
|
public object ToPageList(int pageNumber, int pageSize) |
|
|
|
{ |
|
|
|