From 101bd836360437ada7f28851f13a4f81f26104a2 Mon Sep 17 00:00:00 2001 From: junjun Date: Tue, 1 Aug 2023 15:27:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E4=B8=8D=E5=8C=85=E5=90=AB=E8=B5=B7=E5=A7=8B?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../provider/query/mysql/MysqlQueryProvider.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java index c9ed5d3d45..34505d28ae 100644 --- a/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java @@ -1072,7 +1072,7 @@ public class MysqlQueryProvider extends QueryProvider { date = String.format(MySQLConstants.DATE_FORMAT, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT); } if (request.getOperator().equals("between")) { - whereName = date; + whereName = String.format(MySQLConstants.UNIX_TIMESTAMP, date) + "*1000"; } else { if (StringUtils.equalsIgnoreCase(request.getDateStyle(), "y_Q")) { whereName = String.format(format, @@ -1131,15 +1131,13 @@ public class MysqlQueryProvider extends QueryProvider { whereName = "upper(" + whereName + ")"; } else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) { if (request.getDatasetTableField().getDeType() == 1) { - if (request.getDatasetTableField().getDeExtractType() == 2 - || request.getDatasetTableField().getDeExtractType() == 3 - || request.getDatasetTableField().getDeExtractType() == 4) { - whereValue = String.format(MysqlConstants.WHERE_BETWEEN, value.get(0), value.get(1)); - } else { + if (request.getDatasetTableField().getDeExtractType() == 1) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0)))); + String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0)) - 1000)); String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1)))); whereValue = String.format(MySQLConstants.WHERE_BETWEEN, startTime, endTime); + } else { + whereValue = String.format(MysqlConstants.WHERE_BETWEEN, value.get(0), value.get(1)); } } else { whereValue = String.format(MySQLConstants.WHERE_BETWEEN, value.get(0), value.get(1));