This commit is contained in:
sunkaixuan 2017-01-08 23:16:58 +08:00
parent c342f11fe8
commit e0e1f1a554
5 changed files with 16 additions and 16 deletions

Binary file not shown.

View File

@ -22,7 +22,7 @@ namespace SqlSugar
public int Index { get; set; }
public ResolveExpressType Type { get; set; }
public Expression Expression { get; set; }
public StringBuilder SqlWhere { get; set; }
public StringBuilder ResultString { get; set; }
public bool IsWhereSingle
{
get
@ -60,8 +60,8 @@ namespace SqlSugar
{
BaseResolve resolve = new BaseResolve(new ExpressionParameter() { Expression = this.Expression, Context = this });
resolve.Start();
if (this.SqlWhere == null) return string.Empty;
return this.SqlWhere.ToString();
if (this.ResultString == null) return string.Empty;
return this.ResultString.ToString();
}
#endregion
}

View File

@ -28,21 +28,21 @@ namespace SqlSugar
string leftString = GetLeftString(parameter);
string rightString = GetRightString(parameter);
string binarySql =string.Format(ExpressionConst.BinaryFormatString,leftString,operatorValue,rightString);
string sqlWhereString = base.Context.SqlWhere.ObjToString();
if (base.Context.SqlWhere == null) {
base.Context.SqlWhere = new StringBuilder();
string sqlWhereString = base.Context.ResultString.ObjToString();
if (base.Context.ResultString == null) {
base.Context.ResultString = new StringBuilder();
}
if (sqlWhereString.Contains(ExpressionConst.Format0))
{
base.Context.SqlWhere.Replace(ExpressionConst.Format0, binarySql);
base.Context.ResultString.Replace(ExpressionConst.Format0, binarySql);
}
else
{
base.Context.SqlWhere.Append(binarySql);
base.Context.ResultString.Append(binarySql);
}
if (sqlWhereString.Contains(ExpressionConst.Format1))
{
base.Context.SqlWhere.Replace(ExpressionConst.Format1, ExpressionConst.Format0);
base.Context.ResultString.Replace(ExpressionConst.Format1, ExpressionConst.Format0);
}
}

View File

@ -22,12 +22,12 @@ namespace SqlSugar
fieldName = GetFiledNameByWhereMultiple(parameter, expression, isLeft);
break;
case ResolveExpressType.SelectSingle:
base.Context.SqlWhere = new StringBuilder();
base.Context.SqlWhere.Append(fieldName);
base.Context.ResultString = new StringBuilder();
base.Context.ResultString.Append(fieldName);
break;
case ResolveExpressType.SelectMultiple:
base.Context.SqlWhere = new StringBuilder();
base.Context.SqlWhere.Append(fieldName);
base.Context.ResultString = new StringBuilder();
base.Context.ResultString.Append(fieldName);
break;
case ResolveExpressType.FieldSingle:
break;

View File

@ -33,10 +33,10 @@ namespace SqlSugar
ExpressionType = ExpressionConst.ConstantExpressionType
}));
}
if (isLeft == null && base.Context.SqlWhere == null)
if (isLeft == null && base.Context.ResultString == null)
{
base.Context.SqlWhere = new StringBuilder();
base.Context.SqlWhere.Append(value);
base.Context.ResultString = new StringBuilder();
base.Context.ResultString.Append(value);
}
}
}