From 44ba81f6aab41b5939c6a5e13c776971604467b8 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期三, 26 三月 2025 16:52:44 +0800 Subject: [PATCH] ASDE --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/utils/IndSqlUtils.java | 32 +++++++++++++++++++++----------- 1 files changed, 21 insertions(+), 11 deletions(-) diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/utils/IndSqlUtils.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/utils/IndSqlUtils.java index e33849c..127c42e 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/utils/IndSqlUtils.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/utils/IndSqlUtils.java @@ -164,22 +164,21 @@ whereSql.append("'"); break; case LAST_MONTH: - calendar.add(Calendar.MONTH, -1); // 将当前日期减去一个月,得到上个月的日期 - whereSql.append(indItem.getTimeLabel()); - whereSql.append(" >= '"); - whereSql.append(DateUtils.format(calendar.getTime(), PATTERN_MON)); // 上个月的第一天 - calendar.add(Calendar.MONTH, 1); // 再加一个月,回到当前月 - whereSql.append("' AND '"); whereSql.append(indItem.getTimeLabel()); whereSql.append("' < '"); - whereSql.append(DateUtils.format(calendar.getTime(), PATTERN_MON)); // 当前月 + whereSql.append(DateUtils.format(calendar.getTime(), PATTERN_MON)); + whereSql.append("' AND "); + whereSql.append(indItem.getTimeLabel()); + whereSql.append(" >= '"); + calendar.add(Calendar.MONTH, -1); + whereSql.append(DateUtils.format(calendar.getTime(), PATTERN_MON)); whereSql.append("'"); break; case LAST_MONTH_12: whereSql.append(indItem.getTimeLabel()); whereSql.append(" <= '"); whereSql.append(DateUtils.format(calendar.getTime(), PATTERN_MON)); - whereSql.append("' AND '"); + whereSql.append("' AND "); whereSql.append(indItem.getTimeLabel()); whereSql.append("' >= '"); calendar.add(Calendar.MONTH, -12); @@ -209,6 +208,17 @@ whereSql.append(indItem.getTimeLabel()); whereSql.append("='"); whereSql.append(DateUtils.format(calendar.getTime(), PATTERN_YEAR)); + whereSql.append("'"); + break; + case LAST_HOUR_24: + whereSql.append(indItem.getTimeLabel()); + whereSql.append(" <= '"); + whereSql.append(DateUtils.format(calendar.getTime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); + whereSql.append("' AND "); + whereSql.append(indItem.getTimeLabel()); + whereSql.append(" >= '"); + calendar.add(Calendar.HOUR_OF_DAY, -24); + whereSql.append(DateUtils.format(calendar.getTime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); whereSql.append("'"); break; case CUSTOM: @@ -263,10 +273,10 @@ selectSql.append(result.getSelectSql()); } else { selectSql.append(result.getSelectSql()); - selectSql.append(", "); - selectSql.append(indItem.getTimeLabel()); - selectSql.append(" data_time"); } + selectSql.append(", "); + selectSql.append(indItem.getTimeLabel()); + selectSql.append(" data_time"); result.setSelectSql(selectSql.toString()); // 拼接WHERE -- Gitblit v1.9.3