From f5f6b8f17e06b2a4296285e6084053bf81d5e947 Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 25 Oct 2024 17:27:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=95=B0=E6=8D=AE=E6=BA=90):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Ddate=E7=B1=BB=E5=9E=8B=E8=BF=87=E6=BB=A4=E5=87=BA?= =?UTF-8?q?=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98=20#12912=20#12913?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/engine/trans/CustomWhere2Str.java | 8 +++++++- .../main/java/io/dataease/engine/trans/WhereTree2Str.java | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/engine/trans/CustomWhere2Str.java b/core/core-backend/src/main/java/io/dataease/engine/trans/CustomWhere2Str.java index 254501a46d..5f9222ee02 100644 --- a/core/core-backend/src/main/java/io/dataease/engine/trans/CustomWhere2Str.java +++ b/core/core-backend/src/main/java/io/dataease/engine/trans/CustomWhere2Str.java @@ -130,7 +130,13 @@ public class CustomWhere2Str { } } // 此处获取标准格式的日期 - whereName = originName; + if (StringUtils.equalsIgnoreCase(field.getType(), "date")) { + whereName = String.format(SQLConstants.DE_CAST_DATE_FORMAT, originName, + SQLConstants.DEFAULT_DATE_FORMAT, + SQLConstants.DEFAULT_DATE_FORMAT); + } else { + whereName = originName; + } } } else if (field.getDeType() == 2 || field.getDeType() == 3) { if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) { diff --git a/core/core-backend/src/main/java/io/dataease/engine/trans/WhereTree2Str.java b/core/core-backend/src/main/java/io/dataease/engine/trans/WhereTree2Str.java index 25708c3a0a..5104f1cd92 100644 --- a/core/core-backend/src/main/java/io/dataease/engine/trans/WhereTree2Str.java +++ b/core/core-backend/src/main/java/io/dataease/engine/trans/WhereTree2Str.java @@ -143,7 +143,13 @@ public class WhereTree2Str { originName = String.format(SQLConstants.DE_STR_TO_DATE, String.format(SQLConstants.CONCAT, "'1970-01-01 '", originName), SQLConstants.DEFAULT_DATE_FORMAT); } } - whereName = originName; + if (StringUtils.equalsIgnoreCase(field.getType(), "date")) { + whereName = String.format(SQLConstants.DE_CAST_DATE_FORMAT, originName, + SQLConstants.DEFAULT_DATE_FORMAT, + SQLConstants.DEFAULT_DATE_FORMAT); + } else { + whereName = originName; + } } } else if (field.getDeType() == 2 || field.getDeType() == 3) { if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {