forked from github/dataease
Merge pull request #9156 from dataease/pr@dev-v2@fix_filter
fix: 修复日期过滤逻辑错误
This commit is contained in:
commit
5c7e0511aa
@ -113,12 +113,12 @@ public class CustomWhere2Str {
|
||||
} else {
|
||||
// 如果是时间字段过滤,当条件是等于和不等于的时候转换成between和not between
|
||||
if (field.getDeType() == 1) {
|
||||
if (StringUtils.containsIgnoreCase(whereTerm, "=")) {
|
||||
if (StringUtils.equalsIgnoreCase(whereTerm, " = ")) {
|
||||
whereTerm = " BETWEEN ";
|
||||
// 把value类似过滤组件处理,获得start time和end time
|
||||
Map<String, Long> stringLongMap = Utils.parseDateTimeValue(value);
|
||||
whereValue = String.format(SQLConstants.WHERE_VALUE_BETWEEN, stringLongMap.get("startTime"), stringLongMap.get("endTime"));
|
||||
} else if (StringUtils.containsIgnoreCase(whereTerm, "<>")) {
|
||||
} else if (StringUtils.equalsIgnoreCase(whereTerm, " <> ")) {
|
||||
whereTerm = " NOT BETWEEN ";
|
||||
Map<String, Long> stringLongMap = Utils.parseDateTimeValue(value);
|
||||
whereValue = String.format(SQLConstants.WHERE_VALUE_BETWEEN, stringLongMap.get("startTime"), stringLongMap.get("endTime"));
|
||||
|
@ -149,12 +149,12 @@ public class WhereTree2Str {
|
||||
} else {
|
||||
// 如果是时间字段过滤,当条件是等于和不等于的时候转换成between和not between
|
||||
if (field.getDeType() == 1) {
|
||||
if (StringUtils.containsIgnoreCase(whereTerm, "=")) {
|
||||
if (StringUtils.equalsIgnoreCase(whereTerm, " = ")) {
|
||||
whereTerm = " BETWEEN ";
|
||||
// 把value类似过滤组件处理,获得start time和end time
|
||||
Map<String, Long> stringLongMap = Utils.parseDateTimeValue(value);
|
||||
whereValue = String.format(SQLConstants.WHERE_VALUE_BETWEEN, stringLongMap.get("startTime"), stringLongMap.get("endTime"));
|
||||
} else if (StringUtils.containsIgnoreCase(whereTerm, "<>")) {
|
||||
} else if (StringUtils.equalsIgnoreCase(whereTerm, " <> ")) {
|
||||
whereTerm = " NOT BETWEEN ";
|
||||
Map<String, Long> stringLongMap = Utils.parseDateTimeValue(value);
|
||||
whereValue = String.format(SQLConstants.WHERE_VALUE_BETWEEN, stringLongMap.get("startTime"), stringLongMap.get("endTime"));
|
||||
|
Loading…
Reference in New Issue
Block a user