Update oracle

This commit is contained in:
sunkaixuan 2022-03-29 13:23:41 +08:00
parent 9936bb2c96
commit 053f0bee51
2 changed files with 7 additions and 15 deletions

View File

@ -164,16 +164,8 @@ namespace SqlSugar
}
else if (parameter.DbType == System.Data.DbType.DateTime)
{
if (this.Context.SugarActionType == SugarActionType.Insert)
{
sqlParameter.Value = parameter.Value;
sqlParameter.DbType = System.Data.DbType.DateTime;
}
else
{
sqlParameter.Value = parameter.Value;
sqlParameter.DbType = System.Data.DbType.Date;
}
sqlParameter.Value = parameter.Value;
sqlParameter.DbType = System.Data.DbType.DateTime;
}
else if (parameter.DbType == System.Data.DbType.AnsiStringFixedLength)
{

View File

@ -70,15 +70,15 @@ namespace SqlSugar
case DateType.Month:
return $" ( cast((months_between( {end} , {begin})) as number(9,0) ) )";
case DateType.Day:
return $" ( ROUND(TO_NUMBER({end} - {begin})) )";
return $" ( ROUND(TO_NUMBER(cast({end} as date) - cast({begin} as date))) )";
case DateType.Hour:
return $" ( ROUND(TO_NUMBER({end} - {begin}) * 24) )";
return $" ( ROUND(TO_NUMBER(cast({end} as date) - cast({begin} as date)) * 24) )";
case DateType.Minute:
return $" ( ROUND(TO_NUMBER({end} - {begin}) * 24 * 60) )";
return $" ( ROUND(TO_NUMBER(cast({end} as date) - cast({begin} as date)) * 24 * 60) )";
case DateType.Second:
return $" ( ROUND(TO_NUMBER({end} - {begin}) * 24 * 60 * 60) )";
return $" ( ROUND(TO_NUMBER(cast({end} as date) - cast({begin} as date)) * 24 * 60 * 60) )";
case DateType.Millisecond:
return $" ( ROUND(TO_NUMBER({end} - {begin}) * 24 * 60 * 60 * 60) )";
return $" ( ROUND(TO_NUMBER(cast({end} as date) - cast({begin} as date)) * 24 * 60 * 60 * 60) )";
default:
break;
}