mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-02-25 04:27:14 +08:00
Optimization hits&hasvalue
This commit is contained in:
@@ -88,7 +88,8 @@ namespace SqlSugar
|
||||
string oldOrderValue = this.OrderByValue;
|
||||
string result = null;
|
||||
sql = new StringBuilder();
|
||||
sql.AppendFormat(SqlTemplate, "Count(*)", GetTableNameString, GetWhereValueString, GetGroupByString + HavingInfos, (Skip != null || Take != null) ? null : GetOrderByString);
|
||||
var hints = this.Hints.HasValue() ? $" {this.Hints} Count(*)": "Count(*)";
|
||||
sql.AppendFormat(SqlTemplate,hints, GetTableNameString, GetWhereValueString, GetGroupByString + HavingInfos, (Skip != null || Take != null) ? null : GetOrderByString);
|
||||
if (IsCount)
|
||||
{
|
||||
if (sql.ToString().Contains("-- No table"))
|
||||
|
||||
@@ -58,7 +58,11 @@ namespace SqlSugar
|
||||
public static bool HasValue(this object thisValue)
|
||||
{
|
||||
if (thisValue == null || thisValue == DBNull.Value) return false;
|
||||
return thisValue.ToString() != "";
|
||||
if (thisValue is string s)
|
||||
{
|
||||
return !string.IsNullOrEmpty(s);
|
||||
}
|
||||
return thisValue != null;
|
||||
}
|
||||
|
||||
public static bool HasValue(this IEnumerable<object> thisValue)
|
||||
|
||||
Reference in New Issue
Block a user