mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-18 17:48:11 +08:00
Update Core
This commit is contained in:
@@ -388,6 +388,10 @@ namespace SqlSugar
|
||||
asyncDeleteBuilder.sql = this.DeleteBuilder.sql;
|
||||
asyncDeleteBuilder.WhereInfos = this.DeleteBuilder.WhereInfos;
|
||||
asyncDeleteBuilder.TableWithString = this.DeleteBuilder.TableWithString;
|
||||
if (this.RemoveCacheFunc != null)
|
||||
{
|
||||
asyncDeleteable.RemoveDataCache();
|
||||
}
|
||||
return asyncDeleteable;
|
||||
}
|
||||
|
||||
|
@@ -439,6 +439,10 @@ namespace SqlSugar
|
||||
asyncInsertableBuilder.IsReturnIdentity = this.InsertBuilder.IsReturnIdentity;
|
||||
asyncInsertableBuilder.EntityInfo = this.InsertBuilder.EntityInfo;
|
||||
asyncInsertableBuilder.TableWithString = this.InsertBuilder.TableWithString;
|
||||
if (this.RemoveCacheFunc != null)
|
||||
{
|
||||
asyncInsertable.RemoveDataCache();
|
||||
}
|
||||
return asyncInsertable;
|
||||
}
|
||||
|
||||
|
@@ -540,6 +540,10 @@ namespace SqlSugar
|
||||
asyncUpdateableBuilder.PrimaryKeys = this.UpdateBuilder.PrimaryKeys;
|
||||
asyncUpdateableBuilder.IsOffIdentity = this.UpdateBuilder.IsOffIdentity;
|
||||
asyncUpdateableBuilder.SetValues = this.UpdateBuilder.SetValues;
|
||||
if (this.RemoveCacheFunc != null)
|
||||
{
|
||||
asyncUpdateable.RemoveDataCache();
|
||||
}
|
||||
return asyncUpdateable;
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,7 @@ namespace SqlSugar
|
||||
{
|
||||
var parameter = model.Args[0];
|
||||
var parameter2 = model.Args[1];
|
||||
return string.Format(" (TIMESTAMPDIFF(day,{0},{1})=0) ", parameter.MemberName, parameter2.MemberName); ;
|
||||
return string.Format(" (TIMESTAMPDIFF(day,date({0}),date({1}))=0) ", parameter.MemberName, parameter2.MemberName); ;
|
||||
}
|
||||
|
||||
public override string DateIsSameByType(MethodCallExpressionModel model)
|
||||
|
@@ -63,6 +63,36 @@ namespace SqlSugar
|
||||
this.OrderByValue = oldOrderValue;
|
||||
return result;
|
||||
}
|
||||
private string ToCountSqlString()
|
||||
{
|
||||
base.AppendFilter();
|
||||
string oldOrderValue = this.OrderByValue;
|
||||
string result = null;
|
||||
sql = new StringBuilder();
|
||||
sql.AppendFormat(SqlTemplate, "Count(*)", GetTableNameString, GetWhereValueString, GetGroupByString + HavingInfos, (Skip != null || Take != null) ? null : GetOrderByString);
|
||||
if (IsCount) { return sql.ToString(); }
|
||||
if (Skip != null && Take == null)
|
||||
{
|
||||
if (this.OrderByValue == "ORDER BY ") this.OrderByValue += GetSelectValue.Split(',')[0];
|
||||
result = string.Format(PageTempalte, GetSelectValue, GetTableNameString, GetWhereValueString, GetGroupByString + HavingInfos, (Skip != null || Take != null) ? null : GetOrderByString, Skip.ObjToInt(), long.MaxValue);
|
||||
}
|
||||
else if (Skip == null && Take != null)
|
||||
{
|
||||
if (this.OrderByValue == "ORDER BY ") this.OrderByValue += GetSelectValue.Split(',')[0];
|
||||
result = string.Format(PageTempalte, GetSelectValue, GetTableNameString, GetWhereValueString, GetGroupByString + HavingInfos, GetOrderByString, 0, Take.ObjToInt());
|
||||
}
|
||||
else if (Skip != null && Take != null)
|
||||
{
|
||||
if (this.OrderByValue == "ORDER BY ") this.OrderByValue += GetSelectValue.Split(',')[0];
|
||||
result = string.Format(PageTempalte, GetSelectValue, GetTableNameString, GetWhereValueString, GetGroupByString + HavingInfos, GetOrderByString, Skip.ObjToInt() > 0 ? Skip.ObjToInt() : 0, Take);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = sql.ToString();
|
||||
}
|
||||
this.OrderByValue = oldOrderValue;
|
||||
return result;
|
||||
}
|
||||
public override string ToCountSql(string sql)
|
||||
{
|
||||
if (this.GroupByValue.HasValue())
|
||||
@@ -71,7 +101,7 @@ namespace SqlSugar
|
||||
}
|
||||
else
|
||||
{
|
||||
return Regex.Replace(sql, "^SELECT .+? FROM ", "SELECT COUNT(*) FROM ");
|
||||
return ToCountSqlString();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
Reference in New Issue
Block a user