mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-08 09:20:55 +08:00
fix:修复达梦数据库上时间相减永远输出为0的问题
This commit is contained in:
@@ -389,11 +389,11 @@ namespace FreeSql.Dameng
|
||||
Func<Expression, string> getExp = exparg => ExpressionLambdaToSql(exparg, tsc);
|
||||
switch (memberName)
|
||||
{
|
||||
case "TotalDays": return $"(cast({getExp(date1)} as timestamp with time zone)-{getExp(date2)})";
|
||||
case "TotalHours": return $"((cast({getExp(date1)} as timestamp with time zone)-{getExp(date2)})*24)";
|
||||
case "TotalMilliseconds": return $"((cast({getExp(date1)} as timestamp with time zone)-{getExp(date2)})*{24 * 60 * 60 * 1000})";
|
||||
case "TotalMinutes": return $"((cast({getExp(date1)} as timestamp with time zone)-{getExp(date2)})*{24 * 60})";
|
||||
case "TotalSeconds": return $"((cast({getExp(date1)} as timestamp with time zone)-{getExp(date2)})*{24 * 60 * 60})";
|
||||
case "TotalDays": return $"DATEDIFF(Day, {getExp(date2)}, {getExp(date1)})";
|
||||
case "TotalHours": return $"DATEDIFF(Hour, {getExp(date2)}, {getExp(date1)})";
|
||||
case "TotalMilliseconds": return $"DATEDIFF(MS, {getExp(date2)}, {getExp(date1)})";
|
||||
case "TotalMinutes": return $"DATEDIFF(Minute, {getExp(date2)}, {getExp(date1)})";
|
||||
case "TotalSeconds": return $"DATEDIFF(Second, {getExp(date2)}, {getExp(date1)})";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user