Merge pull request #13363 from dataease/pr@dev-v2@fix_filter
fix(仪表板): 修复date类型时间范围不包含边界的问题
This commit is contained in:
commit
58aaeb7a61
@ -212,7 +212,11 @@ public class ExtWhere2Str {
|
||||
whereName = String.format(SQLConstants.UNIX_TIMESTAMP, whereName);
|
||||
whereValue = String.format(SQLConstants.WHERE_BETWEEN, Long.parseLong(value.get(0)), Long.parseLong(value.get(1)));
|
||||
} else {
|
||||
whereValue = String.format(SQLConstants.WHERE_BETWEEN, Utils.transLong2Str(Long.parseLong(value.get(0))), Utils.transLong2Str(Long.parseLong(value.get(1))));
|
||||
if (StringUtils.equalsIgnoreCase(request.getDatasetTableField().getType(), "date")) {
|
||||
whereValue = String.format(SQLConstants.WHERE_BETWEEN, Utils.transLong2StrShort(Long.parseLong(value.get(0))), Utils.transLong2StrShort(Long.parseLong(value.get(1))));
|
||||
} else {
|
||||
whereValue = String.format(SQLConstants.WHERE_BETWEEN, Utils.transLong2Str(Long.parseLong(value.get(0))), Utils.transLong2Str(Long.parseLong(value.get(1))));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (request.getDatasetTableField().getDeType() == 2
|
||||
|
||||
@ -425,6 +425,12 @@ public class Utils {
|
||||
return simpleDateFormat.format(date);
|
||||
}
|
||||
|
||||
public static String transLong2StrShort(Long ts) {
|
||||
Date date = new Date(ts);
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return simpleDateFormat.format(date);
|
||||
}
|
||||
|
||||
public static List<CalParam> getParams(List<DatasetTableFieldDTO> list) {
|
||||
if (ObjectUtils.isEmpty(list)) return Collections.emptyList();
|
||||
List<CalParam> param = new ArrayList<>();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user