mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 18:22:23 +08:00
-
This commit is contained in:
@@ -90,15 +90,16 @@ UNION ALL
|
||||
|
||||
//Re Set Value
|
||||
var t8 = db.Updateable(updateObj)
|
||||
.ReSetValue(it=>it.Name==(it.SchoolId+"")).ToSql();
|
||||
.ReSetValue(it=>it.Name==(it.Name+1)).ToSql();
|
||||
base.Check(@"UPDATE [Student] SET
|
||||
[SchoolId] = @SchoolId, ( [Name] = (@Const0)),[CreateTime] = @CreateTime,[TestId] = @TestId WHERE[Id] = @Id",
|
||||
[SchoolId]=@SchoolId, [Name] =( [Name] + @Const0 ),[CreateTime]=@CreateTime,[TestId]=@TestId WHERE [Id]=@Id",
|
||||
new List<SugarParameter>() {
|
||||
new SugarParameter("@SchoolId",0),
|
||||
new SugarParameter("@Id",1),
|
||||
new SugarParameter("@TestId",0),
|
||||
new SugarParameter("@CreateTime", Convert.ToDateTime("2017-05-21 09:56:12.610")),
|
||||
new SugarParameter("@Const0", "jack")
|
||||
new SugarParameter("@Const0", 1),
|
||||
new SugarParameter("@Name", "jack")
|
||||
}, t8.Key, t8.Value, "Update t8 error"
|
||||
);
|
||||
|
||||
|
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlSugar
|
||||
@@ -43,7 +44,7 @@ namespace SqlSugar
|
||||
public IUpdateable<T> ReSetValue(Expression<Func<T, bool>> setValueExpression)
|
||||
{
|
||||
var expResult = UpdateBuilder.GetExpressionValue(setValueExpression, ResolveExpressType.WhereSingle);
|
||||
var resultString = expResult.GetResultString();
|
||||
var resultString =Regex.Match(expResult.GetResultString(),@"\((.+)\)").Groups[1].Value;
|
||||
LambdaExpression lambda = setValueExpression as LambdaExpression;
|
||||
var expression = lambda.Body;
|
||||
Check.Exception(!(expression is BinaryExpression), "Expression format error");
|
||||
|
@@ -18,18 +18,19 @@ namespace SqlSugar
|
||||
case ResolveExpressType.FieldSingle:
|
||||
case ResolveExpressType.FieldMultiple:
|
||||
base.Expression = expression.Operand;
|
||||
if (base.Expression is MemberExpression || base.Expression is ConstantExpression)
|
||||
if (base.Expression is BinaryExpression||parameter.BaseExpression is BinaryExpression)
|
||||
{
|
||||
BaseParameter.ChildExpression = base.Expression;
|
||||
parameter.CommonTempData = CommonTempDataType.ChildNodeSet;
|
||||
parameter.CommonTempData = CommonTempDataType.Default;
|
||||
base.Start();
|
||||
parameter.BaseParameter.CommonTempData = parameter.CommonTempData;
|
||||
parameter.BaseParameter.ChildExpression = base.Expression;
|
||||
parameter.CommonTempData = null;
|
||||
}
|
||||
else if (base.Expression is BinaryExpression) {
|
||||
else if (base.Expression is MemberExpression || base.Expression is ConstantExpression)
|
||||
{
|
||||
BaseParameter.ChildExpression = base.Expression;
|
||||
parameter.CommonTempData = CommonTempDataType.Default;
|
||||
parameter.CommonTempData = CommonTempDataType.ChildNodeSet;
|
||||
base.Start();
|
||||
parameter.BaseParameter.CommonTempData = parameter.CommonTempData;
|
||||
parameter.BaseParameter.ChildExpression = base.Expression;
|
||||
|
Reference in New Issue
Block a user