fix(过滤器): sqlserver查询精确到毫秒的源数据有误差

This commit is contained in:
fit2cloud-chenyw 2022-12-26 16:31:48 +08:00
parent 61b846b1ed
commit 9dd6906fcb

View File

@ -1121,7 +1121,7 @@ public class SqlserverQueryProvider extends QueryProvider {
whereValue = "'%" + value.get(0) + "%'";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
if (request.getDatasetTableField().getDeType() == DeTypeConstants.DE_TIME) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
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(SqlServerSQLConstants.WHERE_BETWEEN, startTime, endTime);