From 0723ba6fcf499582438dfcaa7e269e31d57fcd9a Mon Sep 17 00:00:00 2001
From: dongyukun <1208714201@qq.com>
Date: 星期五, 24 一月 2025 15:06:22 +0800
Subject: [PATCH] 派生指标--上月

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/utils/IndSqlUtils.java |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 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..8be3943 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,15 +164,14 @@
                 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:

--
Gitblit v1.9.3