mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
- 修复 */表达式解析问题;#1836
This commit is contained in:
parent
8c9c2e6985
commit
8e12ecd34f
@ -619,6 +619,14 @@ namespace base_entity
|
|||||||
BaseEntity.Initialization(fsql, () => _asyncUow.Value);
|
BaseEntity.Initialization(fsql, () => _asyncUow.Value);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
var sqlt001 = fsql.Select<User1>()
|
||||||
|
.Where(u => u.Id == Guid.Empty)
|
||||||
|
.ToSql(u => u.GroupId / (u.Sort * 60));
|
||||||
|
|
||||||
|
sqlt001 = fsql.Select<User1>()
|
||||||
|
.Where(u => u.Id == Guid.Empty)
|
||||||
|
.ToSql(u => u.GroupId - (u.Sort + 2));
|
||||||
|
|
||||||
var enumToString = fsql.Select<JoinTest01>().First(s => new
|
var enumToString = fsql.Select<JoinTest01>().First(s => new
|
||||||
{
|
{
|
||||||
State = ((int)s.JoinTest01Enum2).ToString()
|
State = ((int)s.JoinTest01Enum2).ToString()
|
||||||
|
@ -946,10 +946,11 @@ namespace FreeSql.Internal
|
|||||||
if (right == "NULL") oper = oper == "=" ? " IS " : " IS NOT ";
|
if (right == "NULL") oper = oper == "=" ? " IS " : " IS NOT ";
|
||||||
switch (oper)
|
switch (oper)
|
||||||
{
|
{
|
||||||
case "%": return _common.Mod(left, right, leftExp.Type, rightExp.Type);
|
case "*": return $"({left} {oper} {right})";
|
||||||
|
case "%": return $"({_common.Mod(left, right, leftExp.Type, rightExp.Type)})";
|
||||||
case "/":
|
case "/":
|
||||||
if (leftExp.Type.IsIntegerType() && rightExp.Type.IsIntegerType()) return _common.Div(left, right, leftExp.Type, rightExp.Type);
|
if (leftExp.Type.IsIntegerType() && rightExp.Type.IsIntegerType()) return $"({_common.Div(left, right, leftExp.Type, rightExp.Type)})";
|
||||||
break;
|
return $"({left} {oper} {right})";
|
||||||
case "AND":
|
case "AND":
|
||||||
case "OR":
|
case "OR":
|
||||||
if (leftMapColumn != null) left = $"{left} = {formatSql(true, leftMapColumn.Attribute.MapType, null, null)}";
|
if (leftMapColumn != null) left = $"{left} = {formatSql(true, leftMapColumn.Attribute.MapType, null, null)}";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user