mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-31 15:56:25 +08:00
EXP Analytic optimization
This commit is contained in:
parent
d3de52b89f
commit
8324841fab
@ -16,10 +16,25 @@ namespace SqlSugar
|
||||
{
|
||||
#region Fields
|
||||
private bool _IsSingle = true;
|
||||
private IDbMethods _DbMehtods { get; set; }
|
||||
#endregion
|
||||
|
||||
#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 ParameterIndex { get; set; }
|
||||
public MappingColumnList MappingColumns { get; set; }
|
||||
|
@ -6,7 +6,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace SqlSugar
|
||||
{
|
||||
public abstract partial class DefaultDbMethod : IDbMethods
|
||||
public partial class DefaultDbMethod : IDbMethods
|
||||
{
|
||||
public virtual string IIF(MethodCallExpressionModel model)
|
||||
{
|
||||
@ -260,5 +260,15 @@ namespace SqlSugar
|
||||
var parameter1 = model.Args[1];
|
||||
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 AggregateCount(MethodCallExpressionModel model);
|
||||
string MappingColumn(MethodCallExpressionModel model);
|
||||
string True();
|
||||
string False();
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ namespace SqlSugar
|
||||
var parentIsRoot = parameter.BaseParameter.CurrentExpression is LambdaExpression;
|
||||
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;
|
||||
}
|
||||
if (parentIsBinary && value != null && value.GetType() == PubConst.BoolType && parameter.BaseExpression != null)
|
||||
@ -47,7 +47,7 @@ namespace SqlSugar
|
||||
parameter.BaseExpression.NodeType == ExpressionType.OrElse;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user