mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-16 13:09:33 +08:00
Synchronization code
This commit is contained in:
parent
fd7cb5beed
commit
2cc36304c5
@ -252,8 +252,8 @@ namespace SqlSugar
|
||||
tableName = this.SqlBuilder.GetTranslationTableName(tableName);
|
||||
this.Context.Ado.ExecuteCommand(string.Format(this.DropTableSql, tableName));
|
||||
return true;
|
||||
}
|
||||
public virtual bool DropTable(string [] tableName)
|
||||
}
|
||||
public virtual bool DropTable(string[] tableName)
|
||||
{
|
||||
foreach (var item in tableName)
|
||||
{
|
||||
|
@ -1358,14 +1358,14 @@ namespace SqlSugar
|
||||
var list= this.ToPivotList(columnSelector, rowSelector, dataSelector);
|
||||
return this.Context.Utilities.SerializeObject(list);
|
||||
}
|
||||
public List<T> ToChildList(Expression<Func<T, object>> parentIdExpression, object primaryKeyValue,bool isContainOneself = true)
|
||||
public List<T> ToChildList(Expression<Func<T, object>> parentIdExpression, object primaryKeyValue, bool isContainOneself = true)
|
||||
{
|
||||
var entity = this.Context.EntityMaintenance.GetEntityInfo<T>();
|
||||
var pk = GetTreeKey(entity);
|
||||
var list = this.ToList();
|
||||
return GetChildList(parentIdExpression, pk, list, primaryKeyValue, isContainOneself);
|
||||
}
|
||||
public async Task<List<T>> ToChildListAsync(Expression<Func<T, object>> parentIdExpression, object primaryKeyValue,bool isContainOneself=true)
|
||||
public async Task<List<T>> ToChildListAsync(Expression<Func<T, object>> parentIdExpression, object primaryKeyValue, bool isContainOneself=true)
|
||||
{
|
||||
var entity = this.Context.EntityMaintenance.GetEntityInfo<T>();
|
||||
var pk = GetTreeKey(entity);
|
||||
@ -1999,6 +1999,7 @@ namespace SqlSugar
|
||||
{
|
||||
if (this.Context.CurrentConnectionConfig.DbType != DbType.SqlServer)
|
||||
{
|
||||
this.QueryBuilder.Offset = "true";
|
||||
return this.ToPageList(pageIndex, pageSize);
|
||||
}
|
||||
else
|
||||
|
@ -32,7 +32,7 @@ namespace SqlSugar
|
||||
bool CreateIndex(string tableName, string [] columnNames, bool isUnique=false);
|
||||
bool CreateIndex(string tableName, string[] columnNames, string IndexName, bool isUnique = false);
|
||||
bool DropTable(string tableName);
|
||||
bool DropTable(params string [] tableName);
|
||||
bool DropTable(params string[] tableName);
|
||||
bool DropTable<T>();
|
||||
bool DropTable<T,T2>();
|
||||
bool DropTable<T, T2,T3>();
|
||||
|
@ -22,6 +22,10 @@ namespace SqlSugar
|
||||
}
|
||||
public override string ToSqlString()
|
||||
{
|
||||
if (this.Offset == "true")
|
||||
{
|
||||
return OffsetPage();
|
||||
}
|
||||
var oldTake = Take;
|
||||
var oldSkip = Skip;
|
||||
var isDistinctPage = IsDistinct && (Take > 1 || Skip > 1);
|
||||
@ -50,6 +54,18 @@ namespace SqlSugar
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private string OffsetPage()
|
||||
{
|
||||
var skip = this.Skip;
|
||||
var take = this.Take;
|
||||
this.Skip = null;
|
||||
this.Take = null;
|
||||
this.Offset = null;
|
||||
var pageSql = $"SELECT * FROM ( SELECT PAGETABLE1.*,ROWNUM PAGEINDEX FROM( { this.ToSqlString() }) PAGETABLE1 WHERE ROWNUM<={skip+take}) WHERE PAGEINDEX>={(skip==0?skip:(skip+1))}";
|
||||
return pageSql;
|
||||
}
|
||||
|
||||
public string _ToSqlString()
|
||||
{
|
||||
string oldOrderBy = this.OrderByValue;
|
||||
|
Loading…
Reference in New Issue
Block a user