mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-10 11:25:00 +08:00
EXP Analytic optimization
This commit is contained in:
@@ -16,10 +16,25 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
private bool _IsSingle = true;
|
private bool _IsSingle = true;
|
||||||
|
private IDbMethods _DbMehtods { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region properties
|
#region properties
|
||||||
public IDbMethods DbMehtods { get; set; }
|
public IDbMethods DbMehtods
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_DbMehtods == null)
|
||||||
|
{
|
||||||
|
_DbMehtods = new DefaultDbMethod();
|
||||||
|
}
|
||||||
|
return _DbMehtods;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_DbMehtods = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
public int Index { get; set; }
|
public int Index { get; set; }
|
||||||
public int ParameterIndex { get; set; }
|
public int ParameterIndex { get; set; }
|
||||||
public MappingColumnList MappingColumns { get; set; }
|
public MappingColumnList MappingColumns { get; set; }
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
namespace SqlSugar
|
namespace SqlSugar
|
||||||
{
|
{
|
||||||
public abstract partial class DefaultDbMethod : IDbMethods
|
public partial class DefaultDbMethod : IDbMethods
|
||||||
{
|
{
|
||||||
public virtual string IIF(MethodCallExpressionModel model)
|
public virtual string IIF(MethodCallExpressionModel model)
|
||||||
{
|
{
|
||||||
@@ -260,5 +260,15 @@ namespace SqlSugar
|
|||||||
var parameter1 = model.Args[1];
|
var parameter1 = model.Args[1];
|
||||||
return string.Format("{0}", parameter1.MemberValue);
|
return string.Format("{0}", parameter1.MemberValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual string True()
|
||||||
|
{
|
||||||
|
return "( 1 = 1 ) ";
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual string False()
|
||||||
|
{
|
||||||
|
return "( 1 = 2 ) ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,5 +47,7 @@ namespace SqlSugar
|
|||||||
string AggregateMax(MethodCallExpressionModel model);
|
string AggregateMax(MethodCallExpressionModel model);
|
||||||
string AggregateCount(MethodCallExpressionModel model);
|
string AggregateCount(MethodCallExpressionModel model);
|
||||||
string MappingColumn(MethodCallExpressionModel model);
|
string MappingColumn(MethodCallExpressionModel model);
|
||||||
|
string True();
|
||||||
|
string False();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace SqlSugar
|
|||||||
var parentIsRoot = parameter.BaseParameter.CurrentExpression is LambdaExpression;
|
var parentIsRoot = parameter.BaseParameter.CurrentExpression is LambdaExpression;
|
||||||
if (parentIsRoot && value != null && value.GetType() == PubConst.BoolType)
|
if (parentIsRoot && value != null && value.GetType() == PubConst.BoolType)
|
||||||
{
|
{
|
||||||
this.Context.Result.Append(value.ObjToBool() ? "( 1 = 1 ) " : "( 1 = 2 ) ");
|
this.Context.Result.Append(value.ObjToBool() ? this.Context.DbMehtods.True() :this.Context.DbMehtods.False());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (parentIsBinary && value != null && value.GetType() == PubConst.BoolType && parameter.BaseExpression != null)
|
if (parentIsBinary && value != null && value.GetType() == PubConst.BoolType && parameter.BaseExpression != null)
|
||||||
@@ -47,7 +47,7 @@ namespace SqlSugar
|
|||||||
parameter.BaseExpression.NodeType == ExpressionType.OrElse;
|
parameter.BaseExpression.NodeType == ExpressionType.OrElse;
|
||||||
if (isLogicOperator)
|
if (isLogicOperator)
|
||||||
{
|
{
|
||||||
AppendMember(parameter, isLeft, (value.ObjToBool() ? "( 1 = 1 ) " : "( 1 = 2 ) "));
|
AppendMember(parameter, isLeft, (value.ObjToBool() ? this.Context.DbMehtods.True(): this.Context.DbMehtods.False()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user