Update oracle

This commit is contained in:
sunkaixuan 2022-03-29 13:28:25 +08:00
parent bddc67fb6c
commit a611ecdc5d
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) else if (parameter.DbType == System.Data.DbType.DateTime)
{ {
if (this.Context.SugarActionType == SugarActionType.Insert) sqlParameter.Value = parameter.Value;
{ sqlParameter.DbType = System.Data.DbType.DateTime;
sqlParameter.Value = parameter.Value;
sqlParameter.DbType = System.Data.DbType.DateTime;
}
else
{
sqlParameter.Value = parameter.Value;
sqlParameter.DbType = System.Data.DbType.Date;
}
} }
else if (parameter.DbType == System.Data.DbType.AnsiStringFixedLength) else if (parameter.DbType == System.Data.DbType.AnsiStringFixedLength)
{ {

View File

@ -70,15 +70,15 @@ namespace SqlSugar
case DateType.Month: case DateType.Month:
return $" ( cast((months_between( {end} , {begin})) as number(9,0) ) )"; return $" ( cast((months_between( {end} , {begin})) as number(9,0) ) )";
case DateType.Day: case DateType.Day:
return $" ( ROUND(TO_NUMBER({end} - {begin})) )"; return $" ( ROUND(TO_NUMBER(cast({end} as date) - cast({begin} as date))) )";
case DateType.Hour: 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: 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: 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: 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: default:
break; break;
} }