|
|
@ -21,13 +21,14 @@ namespace SqlSugar |
|
|
|
var isBool = expression.Type == UtilConstants.BoolType; |
|
|
|
var isValueBool = isValue && isBool && parameter.BaseExpression == null; |
|
|
|
var isLength = memberName == "Length" && childIsMember && childExpression.Type == UtilConstants.StringType; |
|
|
|
var isDateValue = memberName.IsIn(Enum.GetNames(typeof(DateType))) &&(childIsMember&&childExpression.Type == UtilConstants.DateType); |
|
|
|
var isDateValue = memberName.IsIn(Enum.GetNames(typeof(DateType))) && (childIsMember && childExpression.Type == UtilConstants.DateType); |
|
|
|
var isLogicOperator = ExpressionTool.IsLogicOperator(baseParameter.OperatorValue) || baseParameter.OperatorValue.IsNullOrEmpty(); |
|
|
|
var isHasValue = isLogicOperator && memberName == "HasValue" && expression.Expression != null && expression.NodeType == ExpressionType.MemberAccess; |
|
|
|
var isDateDate = memberName == "Date" && expression.Expression.Type == UtilConstants.DateType; |
|
|
|
var isMemberValue = expression.Expression != null && expression.Expression.NodeType != ExpressionType.Parameter && !isValueBool; |
|
|
|
var isSingle = parameter.Context.ResolveType == ResolveExpressType.WhereSingle; |
|
|
|
|
|
|
|
var fieldIsBool = isBool && isLogicOperator; |
|
|
|
baseParameter.ChildExpression = expression; |
|
|
|
if (isLength) |
|
|
|
{ |
|
|
|
ResolveLength(parameter, isLeft, expression); |
|
|
@ -56,9 +57,12 @@ namespace SqlSugar |
|
|
|
{ |
|
|
|
ResolveMemberValue(parameter, baseParameter, isLeft, isSetTempData, expression); |
|
|
|
} |
|
|
|
else if (fieldIsBool) |
|
|
|
{ |
|
|
|
ResolvefieldIsBool(parameter, baseParameter, isLeft, isSetTempData, expression, isSingle); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
baseParameter.ChildExpression = expression; |
|
|
|
string fieldName = string.Empty; |
|
|
|
switch (parameter.Context.ResolveType) |
|
|
|
{ |
|
|
@ -165,6 +169,19 @@ namespace SqlSugar |
|
|
|
AppendValue(parameter, isLeft, value); |
|
|
|
} |
|
|
|
} |
|
|
|
private void ResolvefieldIsBool(ExpressionParameter parameter, ExpressionParameter baseParameter, bool? isLeft, bool isSetTempData, MemberExpression expression, bool isSingle) |
|
|
|
{ |
|
|
|
var fieldName = GetName(parameter, expression, isLeft, isSingle); |
|
|
|
if (isSetTempData) |
|
|
|
{ |
|
|
|
baseParameter.CommonTempData = fieldName; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
fieldName = this.Context.DbMehtods.EqualTrue(fieldName.ObjToString()); |
|
|
|
AppendMember(parameter, isLeft, fieldName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void ResolveDateDate(ExpressionParameter parameter, bool? isLeft, MemberExpression expression) |
|
|
|
{ |
|
|
@ -295,7 +312,7 @@ namespace SqlSugar |
|
|
|
string shortName = expression.Expression.ToString(); |
|
|
|
string fieldName = expression.Member.Name; |
|
|
|
fieldName = this.Context.GetDbColumnName(expression.Expression.Type.Name, fieldName); |
|
|
|
fieldName = Context.GetTranslationColumnName(shortName +UtilConstants.Dot+ fieldName); |
|
|
|
fieldName = Context.GetTranslationColumnName(shortName + UtilConstants.Dot + fieldName); |
|
|
|
return fieldName; |
|
|
|
} |
|
|
|
|
|
|
|