Merge pull request #9159 from dataease/pr@dev-v2@fix_filter

fix: 修复日期过滤逻辑错误 #9155
This commit is contained in:
Junjun 2024-04-17 13:09:25 +08:00 committed by GitHub
commit b58e61f24a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -86,18 +86,17 @@ public class CustomWhere2Str {
res.add("(" + whereName + " IN ('" + String.join("','", request.getEnumCheckField()) + "'))"); res.add("(" + whereName + " IN ('" + String.join("','", request.getEnumCheckField()) + "'))");
} }
} else { } else {
if (field.getDeType() == 1) {
// 规定几种日期格式一一匹配匹配到就是该格式
whereName = String.format(SQLConstants.UNIX_TIMESTAMP, whereName);
}
List<ChartCustomFilterItemDTO> filter = request.getFilter(); List<ChartCustomFilterItemDTO> filter = request.getFilter();
for (ChartCustomFilterItemDTO filterItemDTO : filter) { for (ChartCustomFilterItemDTO filterItemDTO : filter) {
String value = filterItemDTO.getValue(); String value = filterItemDTO.getValue();
String whereTerm = Utils.transFilterTerm(filterItemDTO.getTerm()); String whereTerm = Utils.transFilterTerm(filterItemDTO.getTerm());
String whereValue = ""; String whereValue = "";
// String whereNameReal;
if (field.getDeType() == 1) {
// 规定几种日期格式一一匹配匹配到就是该格式
whereName = String.format(SQLConstants.UNIX_TIMESTAMP, whereName);
}
if (StringUtils.equalsIgnoreCase(filterItemDTO.getTerm(), "null")) { if (StringUtils.equalsIgnoreCase(filterItemDTO.getTerm(), "null")) {
whereValue = ""; whereValue = "";
} else if (StringUtils.equalsIgnoreCase(filterItemDTO.getTerm(), "not_null")) { } else if (StringUtils.equalsIgnoreCase(filterItemDTO.getTerm(), "not_null")) {