mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-30 12:47:57 +08:00
UpdateColumns SqlFunc.IIF SqlFunc.IF BUG
This commit is contained in:
parent
a43817a402
commit
8fd8deb4c5
@ -93,6 +93,18 @@ namespace OrmTest.Demo
|
|||||||
dtList.Add(dt);
|
dtList.Add(dt);
|
||||||
dtList.Add(dt2);
|
dtList.Add(dt2);
|
||||||
var t666 = db.Updateable(dtList).AS("student").WhereColumns("id").With(SqlWith.UpdLock).ExecuteCommand();
|
var t666 = db.Updateable(dtList).AS("student").WhereColumns("id").With(SqlWith.UpdLock).ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
|
var t20 = db.Updateable<Student>().UpdateColumns(p => new Student()
|
||||||
|
{
|
||||||
|
SchoolId = SqlFunc.IIF(p.Id == 1, 2, 3)
|
||||||
|
}).Where(p => p.Id == 10000).ExecuteCommand();
|
||||||
|
var t21= db.Updateable<Student>().UpdateColumns(p => new Student()
|
||||||
|
{
|
||||||
|
SchoolId = SqlFunc.IF(p.Id==1).Return(1).End(p.Id)
|
||||||
|
}).Where(p => p.Id == 10000).ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,10 @@ namespace SqlSugar
|
|||||||
|
|
||||||
public virtual string GetNoTranslationColumnName(string name)
|
public virtual string GetNoTranslationColumnName(string name)
|
||||||
{
|
{
|
||||||
|
if (name.Contains("="))
|
||||||
|
{
|
||||||
|
name=name.Split('=').First();
|
||||||
|
}
|
||||||
if (!name.Contains(SqlTranslationLeft)) return name;
|
if (!name.Contains(SqlTranslationLeft)) return name;
|
||||||
return name == null ? string.Empty : Regex.Match(name, @".*" + "\\" + SqlTranslationLeft + "(.*?)" + "\\" + SqlTranslationRight + "").Groups[1].Value;
|
return name == null ? string.Empty : Regex.Match(name, @".*" + "\\" + SqlTranslationLeft + "(.*?)" + "\\" + SqlTranslationRight + "").Groups[1].Value;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
CaseWhenResolve caseResole = new CaseWhenResolve(express, this.Context, parameter.OppsiteExpression);
|
CaseWhenResolve caseResole = new CaseWhenResolve(express, this.Context, parameter.OppsiteExpression);
|
||||||
var appendSql = caseResole.GetSql();
|
var appendSql = caseResole.GetSql();
|
||||||
if (this.Context.ResolveType.IsIn(ResolveExpressType.SelectMultiple, ResolveExpressType.SelectSingle))
|
if (this.Context.ResolveType.IsIn(ResolveExpressType.SelectMultiple, ResolveExpressType.SelectSingle,ResolveExpressType.Update))
|
||||||
{
|
{
|
||||||
parameter.BaseParameter.CommonTempData = appendSql;
|
parameter.BaseParameter.CommonTempData = appendSql;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user