mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
Add IUpdateable<T> Where(string whereSql,object parameters=null)
This commit is contained in:
@@ -59,6 +59,8 @@ namespace OrmTest.Demo
|
|||||||
//Column is null no update
|
//Column is null no update
|
||||||
db.Updateable(updateObj).Where(true).ExecuteCommand();
|
db.Updateable(updateObj).Where(true).ExecuteCommand();
|
||||||
|
|
||||||
|
//sql
|
||||||
|
db.Updateable(updateObj).Where("id=@x",new { x="1"}).ExecuteCommand();
|
||||||
|
|
||||||
var t12 = db.Updateable<School>().AS("Student").UpdateColumns(it => new School() { Name = "jack" }).Where(it => it.Id == 1).ExecuteCommandAsync();
|
var t12 = db.Updateable<School>().AS("Student").UpdateColumns(it => new School() { Name = "jack" }).Where(it => it.Id == 1).ExecuteCommandAsync();
|
||||||
t12.Wait();
|
t12.Wait();
|
||||||
|
@@ -86,6 +86,12 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return "t";
|
return "t";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public string GetWhere(string fieldName,string conditionalType,int? parameterIndex=null)
|
||||||
|
{
|
||||||
|
return string.Format(" {0} {1} {2}{3} ",fieldName,conditionalType,this.SqlParameterKeyWord,fieldName+ parameterIndex);
|
||||||
|
}
|
||||||
public virtual string GetUnionAllSql(List<string> sqlList)
|
public virtual string GetUnionAllSql(List<string> sqlList)
|
||||||
{
|
{
|
||||||
return string.Join("UNION ALL \r\n", sqlList);
|
return string.Join("UNION ALL \r\n", sqlList);
|
||||||
|
@@ -196,6 +196,17 @@ namespace SqlSugar
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IUpdateable<T> Where(string whereSql, object parameters = null)
|
||||||
|
{
|
||||||
|
if (whereSql.HasValue()) {
|
||||||
|
UpdateBuilder.WhereValues.Add(whereSql);
|
||||||
|
}
|
||||||
|
if (parameters != null) {
|
||||||
|
UpdateBuilder.Parameters.AddRange(Context.Ado.GetParameters(parameters));
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public IUpdateable<T> With(string lockString)
|
public IUpdateable<T> With(string lockString)
|
||||||
{
|
{
|
||||||
if (this.Context.CurrentConnectionConfig.DbType == DbType.SqlServer)
|
if (this.Context.CurrentConnectionConfig.DbType == DbType.SqlServer)
|
||||||
|
@@ -35,6 +35,8 @@ namespace SqlSugar
|
|||||||
string GetNoTranslationColumnName(string name);
|
string GetNoTranslationColumnName(string name);
|
||||||
string GetPackTable(string sql,string shortName);
|
string GetPackTable(string sql,string shortName);
|
||||||
string GetDefaultShortName();
|
string GetDefaultShortName();
|
||||||
|
|
||||||
|
string GetWhere(string fieldName, string conditionalType, int? parameterIndex = null);
|
||||||
string GetUnionAllSql(List<string> sqlList);
|
string GetUnionAllSql(List<string> sqlList);
|
||||||
string GetUnionSql(List<string> sqlList);
|
string GetUnionSql(List<string> sqlList);
|
||||||
void RepairReplicationParameters(ref string appendSql, SugarParameter[] parameters, int addIndex);
|
void RepairReplicationParameters(ref string appendSql, SugarParameter[] parameters, int addIndex);
|
||||||
|
@@ -18,6 +18,7 @@ namespace SqlSugar
|
|||||||
IUpdateable<T> With(string lockString);
|
IUpdateable<T> With(string lockString);
|
||||||
IUpdateable<T> Where(bool isNoUpdateNull,bool IsOffIdentity = false);
|
IUpdateable<T> Where(bool isNoUpdateNull,bool IsOffIdentity = false);
|
||||||
IUpdateable<T> Where(Expression<Func<T, bool>> expression);
|
IUpdateable<T> Where(Expression<Func<T, bool>> expression);
|
||||||
|
IUpdateable<T> Where(string whereSql,object parameters=null);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Non primary key entity update function
|
/// Non primary key entity update function
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Reference in New Issue
Block a user