mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +08:00
Update exp to sql
This commit is contained in:
parent
d603994ac6
commit
d26327a39f
@ -102,6 +102,21 @@ namespace OrmTest
|
||||
a = string.IsNullOrEmpty(it.Name)
|
||||
}).ToList();
|
||||
|
||||
var blist4 = Db.Queryable<BoolTest3>().Select(it => new BoolTest3()
|
||||
{
|
||||
a = SqlFunc.IIF(it.a == true, true, false)
|
||||
}).ToList();
|
||||
|
||||
|
||||
var blist5 = Db.Queryable<BoolTest3>().Select(it => new BoolTest3()
|
||||
{
|
||||
a = SqlFunc.IF(it.a == true).Return(true).End(false)
|
||||
}).ToList();
|
||||
|
||||
var blist6 = Db.Queryable<BoolTest3>().Select(it => new BoolTest3()
|
||||
{
|
||||
a =it.a==true?true:false
|
||||
}).ToList();
|
||||
var db = Db;
|
||||
db.CodeFirst.InitTables<UserInfo, UserIpRuleInfo>();
|
||||
db.Deleteable<UserInfo>().ExecuteCommand();
|
||||
|
@ -483,7 +483,7 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (item.Type == UtilConstants.BoolType && item is MethodCallExpression)
|
||||
else if (item.Type == UtilConstants.BoolType && item is MethodCallExpression && IsNotCaseExpression(item))
|
||||
{
|
||||
this.Expression = item;
|
||||
this.Start();
|
||||
@ -518,6 +518,22 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsNotCaseExpression(Expression item)
|
||||
{
|
||||
if ((item as MethodCallExpression).Method.Name == "IIF")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((item as MethodCallExpression).Method.Name == "End"&&item.ToString().Contains("IF("))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, string> GetMappingColumns(Expression currentExpression)
|
||||
{
|
||||
Dictionary<string, string> result = new Dictionary<string, string>();
|
||||
|
Loading…
Reference in New Issue
Block a user