mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-02-27 16:50:33 +08:00
Update exp to sql (Sqlite DateTime.Date)
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlSugar
|
||||
{
|
||||
public class ExpressionContextCase
|
||||
{
|
||||
public bool IsDateString { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ namespace SqlSugar
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public virtual ExpressionContextCase Case{ get; set; }
|
||||
public ExpressionOutParameter SugarContext { get; set; }
|
||||
public IDbMethods DbMehtods
|
||||
{
|
||||
|
||||
@@ -517,7 +517,14 @@ namespace SqlSugar
|
||||
var isConst = parameter.CommonTempData.GetType() == UtilConstants.DateType;
|
||||
if (isConst)
|
||||
{
|
||||
AppendValue(parameter, isLeft, parameter.CommonTempData.ObjToDate().Date);
|
||||
if (this.Context?.Case?.IsDateString==true)
|
||||
{
|
||||
AppendMember(parameter, isLeft, GetToDateShort("'" + parameter.CommonTempData.ObjToDate().Date.ToString("yyyy-MM-dd") + "'"));
|
||||
}
|
||||
else
|
||||
{
|
||||
AppendValue(parameter, isLeft, parameter.CommonTempData.ObjToDate().Date);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -4,6 +4,9 @@ namespace SqlSugar
|
||||
{
|
||||
public class SqliteExpressionContext : ExpressionContext, ILambdaExpressions
|
||||
{
|
||||
public override ExpressionContextCase Case { get; set; } = new ExpressionContextCase() {
|
||||
IsDateString= true,
|
||||
};
|
||||
public SqlSugarProvider Context { get; set; }
|
||||
public SqliteExpressionContext()
|
||||
{
|
||||
|
||||
@@ -156,6 +156,7 @@
|
||||
<Compile Include="Entities\DefaultCustom.cs" />
|
||||
<Compile Include="Entities\DeleteNavOptions.cs" />
|
||||
<Compile Include="Entities\JoinInfoParameter.cs" />
|
||||
<Compile Include="ExpressionsToSql\Common\ExpressionContextCase.cs" />
|
||||
<Compile Include="ExpressionsToSql\Common\ParameterExpressionVisitor.cs" />
|
||||
<Compile Include="ExpressionsToSql\Common\ListAnyParameter.cs" />
|
||||
<Compile Include="ExpressionsToSql\Common\MapperSql.cs" />
|
||||
|
||||
Reference in New Issue
Block a user