From 24bd5d00f2c32ea7ee2f9c24487c1f607b5b39f0 Mon Sep 17 00:00:00 2001 From: junjun Date: Thu, 17 Oct 2024 14:19:39 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E7=BB=84=E4=BB=B6=E6=94=AF=E6=8C=81=E6=95=B0=E5=80=BC?= =?UTF-8?q?=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataease/commons/utils/SqlparserUtils.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/commons/utils/SqlparserUtils.java b/core/core-backend/src/main/java/io/dataease/commons/utils/SqlparserUtils.java index 74654e4784..df1f2a89da 100644 --- a/core/core-backend/src/main/java/io/dataease/commons/utils/SqlparserUtils.java +++ b/core/core-backend/src/main/java/io/dataease/commons/utils/SqlparserUtils.java @@ -598,11 +598,19 @@ public class SqlparserUtils { if (sqlVariableDetails.getOperator().equals("in")) { return "'" + String.join("','", sqlVariableDetails.getValue()) + "'"; } else if (sqlVariableDetails.getOperator().equals("between")) { - SimpleDateFormat simpleDateFormat = new SimpleDateFormat(sqlVariableDetails.getType().size() > 1 ? (String) sqlVariableDetails.getType().get(1).replace("DD", "dd").replace("YYYY", "yyyy") : "yyyy"); - if (StringUtils.endsWith(sqlVariableDetails.getId(), START_END_SEPARATOR)) { - return simpleDateFormat.format(new Date(Long.parseLong((String) sqlVariableDetails.getValue().get(1)))); + if (sqlVariableDetails.getDeType() == 1) { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(sqlVariableDetails.getType().size() > 1 ? (String) sqlVariableDetails.getType().get(1).replace("DD", "dd").replace("YYYY", "yyyy") : "yyyy"); + if (StringUtils.endsWith(sqlVariableDetails.getId(), START_END_SEPARATOR)) { + return simpleDateFormat.format(new Date(Long.parseLong((String) sqlVariableDetails.getValue().get(1)))); + } else { + return simpleDateFormat.format(new Date(Long.parseLong((String) sqlVariableDetails.getValue().get(0)))); + } } else { - return simpleDateFormat.format(new Date(Long.parseLong((String) sqlVariableDetails.getValue().get(0)))); + if (StringUtils.endsWith(sqlVariableDetails.getId(), START_END_SEPARATOR)) { + return sqlVariableDetails.getValue().get(1); + } else { + return sqlVariableDetails.getValue().get(0); + } } } else { return (String) sqlVariableDetails.getValue().get(0);