From 0cbbe2c1cbfbf73e02e1796d921c2911c96d370b Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期一, 23 十二月 2024 11:46:31 +0800
Subject: [PATCH] Merge branch 'master' of http://dlindusit.com:53929/r/iailab-plat

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/utils/IndSqlUtils.java |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 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 c20dadd..4636904 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
@@ -50,6 +50,7 @@
         if (indItem == null) {
             return result;
         }
+        result.setIndItemAtom(indItem);
         IndDataSetDTO dataSet = indDataSetService.getDet(indItem.getDataSet());
         if (dataSet == null) {
             return result;
@@ -94,11 +95,15 @@
 
         // 拼接SELECT
         StringBuilder selectSql = new StringBuilder();
-        if (StringUtils.isNotBlank(indItem.getDimension())){
+        if (StringUtils.isNotBlank(indItem.getDimension()) && StringUtils.isNotBlank(result.getIndItemAtom().getStatFunc())){
             selectSql.append(indItem.getDimension());
             selectSql.append(", ");
             selectSql.append(result.getSelectSql());
-        }else{
+        }
+        else if(StringUtils.isBlank(indItem.getDimension()) && StringUtils.isNotBlank(result.getIndItemAtom().getStatFunc())){
+            selectSql.append(result.getSelectSql());
+        }
+        else{
             selectSql.append(result.getSelectSql());
             selectSql.append(", ");
             selectSql.append(indItem.getTimeLabel());
@@ -188,9 +193,9 @@
                 whereSql.append(indItem.getTimeLabel());
                 whereSql.append(" <= '");
                 whereSql.append(DateUtils.format(indItem.getTimeEnd(), PATTERN_MON));
-                whereSql.append("' AND '");
+                whereSql.append("' AND ");
                 whereSql.append(indItem.getTimeLabel());
-                whereSql.append("' >= '");
+                whereSql.append(" >= '");
                 whereSql.append(DateUtils.format(indItem.getTimeStart(), PATTERN_MON));
                 whereSql.append("'");
                 break;

--
Gitblit v1.9.3