mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-12 00:28:02 +08:00
Synchronization code
This commit is contained in:
parent
eda7c878c8
commit
0e15d2aa10
@ -328,6 +328,11 @@ namespace SqlSugar
|
|||||||
if (this.Context.Result.IsLockCurrentParameter == false)
|
if (this.Context.Result.IsLockCurrentParameter == false)
|
||||||
{
|
{
|
||||||
var expression = ((UnaryExpression)item).Operand as MemberExpression;
|
var expression = ((UnaryExpression)item).Operand as MemberExpression;
|
||||||
|
var negateString = string.Empty;
|
||||||
|
if (item.NodeType == ExpressionType.Negate)
|
||||||
|
{
|
||||||
|
negateString = " -1*";
|
||||||
|
}
|
||||||
var isDateTimeNow = ((UnaryExpression)item).Operand.ToString() == "DateTime.Now";
|
var isDateTimeNow = ((UnaryExpression)item).Operand.ToString() == "DateTime.Now";
|
||||||
if (expression.Expression == null && !isDateTimeNow)
|
if (expression.Expression == null && !isDateTimeNow)
|
||||||
{
|
{
|
||||||
@ -337,14 +342,14 @@ namespace SqlSugar
|
|||||||
this.Expression = item;
|
this.Expression = item;
|
||||||
this.Start();
|
this.Start();
|
||||||
parameter.IsAppendResult();
|
parameter.IsAppendResult();
|
||||||
this.Context.Result.Append(this.Context.GetAsString(asName, parameter.CommonTempData.ObjToString()));
|
this.Context.Result.Append(negateString + this.Context.GetAsString(asName, parameter.CommonTempData.ObjToString()));
|
||||||
this.Context.Result.CurrentParameter = null;
|
this.Context.Result.CurrentParameter = null;
|
||||||
}
|
}
|
||||||
else if (expression.Expression is ConstantExpression || isDateTimeNow)
|
else if (expression.Expression is ConstantExpression || isDateTimeNow)
|
||||||
{
|
{
|
||||||
string parameterName = this.Context.SqlParameterKeyWord + "constant" + this.Context.ParameterIndex;
|
string parameterName = this.Context.SqlParameterKeyWord + "constant" + this.Context.ParameterIndex;
|
||||||
this.Context.ParameterIndex++;
|
this.Context.ParameterIndex++;
|
||||||
parameter.Context.Result.Append(this.Context.GetAsString(asName, parameterName));
|
parameter.Context.Result.Append(negateString + this.Context.GetAsString(asName, parameterName));
|
||||||
this.Context.Parameters.Add(new SugarParameter(parameterName, ExpressionTool.GetMemberValue(expression.Member, expression)));
|
this.Context.Parameters.Add(new SugarParameter(parameterName, ExpressionTool.GetMemberValue(expression.Member, expression)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -355,7 +360,7 @@ namespace SqlSugar
|
|||||||
this.Expression = expression;
|
this.Expression = expression;
|
||||||
this.Start();
|
this.Start();
|
||||||
parameter.IsAppendResult();
|
parameter.IsAppendResult();
|
||||||
this.Context.Result.Append(this.Context.GetAsString(asName, parameter.CommonTempData.ObjToString()));
|
this.Context.Result.Append(negateString + this.Context.GetAsString(asName, parameter.CommonTempData.ObjToString()));
|
||||||
this.Context.Result.CurrentParameter = null;
|
this.Context.Result.CurrentParameter = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user