mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 14:04:44 +08:00
-
This commit is contained in:
parent
cee667117a
commit
f652bc3ddc
@ -44,6 +44,11 @@ namespace OrmTest.Demo
|
|||||||
|
|
||||||
//Where By Expression
|
//Where By Expression
|
||||||
var t9 = db.Updateable(updateObj).Where(it => it.Id == 1).ExecuteCommand();
|
var t9 = db.Updateable(updateObj).Where(it => it.Id == 1).ExecuteCommand();
|
||||||
|
|
||||||
|
//Where
|
||||||
|
var t10= db.Updateable<Student>()
|
||||||
|
.UpdateColumns(it => new Student() { Name = "jack", SchoolId =1 })
|
||||||
|
.Where(it => it.Id == 11).ExecuteCommand();
|
||||||
}
|
}
|
||||||
public static SqlSugarClient GetInstance()
|
public static SqlSugarClient GetInstance()
|
||||||
{
|
{
|
||||||
|
@ -119,8 +119,8 @@ UNION ALL
|
|||||||
string name = "x";
|
string name = "x";
|
||||||
var t10 = db.Updateable<Student>().UpdateColumns(it => new Student() { Name =name, SchoolId=updateObj.SchoolId }).Where(it=>it.Id==11).ToSql();
|
var t10 = db.Updateable<Student>().UpdateColumns(it => new Student() { Name =name, SchoolId=updateObj.SchoolId }).Where(it=>it.Id==11).ToSql();
|
||||||
base.Check(@"UPDATE [Student] SET
|
base.Check(@"UPDATE [Student] SET
|
||||||
[SchoolId] = [@Const0] , [Name] = [@constant1] WHERE ( [Id] = @Id1 )", new List<SugarParameter>() {
|
[SchoolId] = @Const0 , [Name] = @const3 WHERE ( [Id] = @Id1 )", new List<SugarParameter>() {
|
||||||
new SugarParameter("@constant1","x"),
|
new SugarParameter("@const3","x"),
|
||||||
new SugarParameter("@Const0",18),
|
new SugarParameter("@Const0",18),
|
||||||
new SugarParameter("@Id1",11)},
|
new SugarParameter("@Id1",11)},
|
||||||
t10.Key,
|
t10.Key,
|
||||||
|
@ -150,9 +150,9 @@ namespace SqlSugar
|
|||||||
return string.Format(" {0} {1} {2} ", GetTranslationTableName(fieldValue), "AS", GetTranslationColumnName(asName));
|
return string.Format(" {0} {1} {2} ", GetTranslationTableName(fieldValue), "AS", GetTranslationColumnName(asName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual string GetEqString(string asName, string fieldValue)
|
public virtual string GetEqString(string eqName, string fieldValue)
|
||||||
{
|
{
|
||||||
return string.Format(" {2} {1} {0} ", GetTranslationTableName(fieldValue), "=", GetTranslationColumnName(asName));
|
return string.Format(" {0} {1} {2} ", GetTranslationColumnName(eqName), "=", fieldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual string GetAsString(string asName, string fieldValue, string fieldShortName)
|
public virtual string GetAsString(string asName, string fieldValue, string fieldShortName)
|
||||||
|
@ -53,7 +53,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
base.Expression = item;
|
base.Expression = item;
|
||||||
base.Start();
|
base.Start();
|
||||||
string parameterName = this.Context.SqlParameterKeyWord + "constant" + i;
|
string parameterName = this.Context.SqlParameterKeyWord + "const" + this.ContentIndex;
|
||||||
parameter.Context.Result.Append(base.Context.GetEqString(memberName, parameterName));
|
parameter.Context.Result.Append(base.Context.GetEqString(memberName, parameterName));
|
||||||
this.Context.Parameters.Add(new SugarParameter(parameterName, parameter.CommonTempData));
|
this.Context.Parameters.Add(new SugarParameter(parameterName, parameter.CommonTempData));
|
||||||
}
|
}
|
||||||
@ -73,7 +73,8 @@ namespace SqlSugar
|
|||||||
base.Expression = item;
|
base.Expression = item;
|
||||||
base.Start();
|
base.Start();
|
||||||
parameter.IsAppendResult();
|
parameter.IsAppendResult();
|
||||||
base.Context.Result.Append(base.Context.GetEqString(memberName, parameter.CommonTempData.ObjToString()));
|
string parameterName = this.Context.SqlParameterKeyWord + "const" + +this.ContentIndex; ;
|
||||||
|
parameter.Context.Result.Append(base.Context.GetEqString(memberName, parameter.CommonTempData.ObjToString()));
|
||||||
base.Context.Result.CurrentParameter = null;
|
base.Context.Result.CurrentParameter = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user