forked from github/dataease
Merge pull request #4904 from dataease/pr@dev@fix_date_filter
fix(视图): 修复日期不能过滤的问题
This commit is contained in:
commit
2c59ecc19a
@ -1098,26 +1098,21 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
|
||||
whereValue = "'%" + value.get(0) + "%'";
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == 1
|
||||
&& (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().getDeType() == 1) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
|
||||
whereValue = String.format(MysqlConstants.WHERE_BETWEEN, startTime, endTime);
|
||||
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 {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
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 {
|
||||
// doris field type test
|
||||
/*if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
|
||||
whereValue = String.format(MysqlConstants.WHERE_NUMBER_VALUE, value.get(0));
|
||||
} else {
|
||||
whereValue = String.format(MysqlConstants.WHERE_VALUE_VALUE, value.get(0));
|
||||
}*/
|
||||
whereValue = String.format(MysqlConstants.WHERE_VALUE_VALUE, value.get(0));
|
||||
}
|
||||
list.add(SQLObj.builder()
|
||||
|
@ -1105,16 +1105,17 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
|
||||
whereValue = "'%" + value.get(0) + "%'";
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
|
||||
if (request.getDatasetTableField().getDeType() == 1
|
||||
&& (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().getDeType() == 1) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
|
||||
whereValue = String.format(MySQLConstants.WHERE_BETWEEN, startTime, endTime);
|
||||
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 {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
|
||||
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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user