From 3e18d4bfbf2c657b08b21512c2d884cc9d59df7b Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期一, 14 十月 2024 16:29:49 +0800 Subject: [PATCH] 模型运行 --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/utils/IndSqlUtils.java | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 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 54c1faa..7e20f14 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 @@ -4,12 +4,14 @@ import com.iailab.module.data.common.enums.IndStatFuncEnum; import com.iailab.module.data.common.enums.IndTimeLimitEnum; import com.iailab.module.data.ind.data.dto.IndDataSetDTO; +import com.iailab.module.data.ind.data.service.IndDataSetFieldService; import com.iailab.module.data.ind.data.service.IndDataSetService; import com.iailab.module.data.ind.item.service.IndItemAtomService; import com.iailab.module.data.ind.item.service.IndItemDerService; import com.iailab.module.data.ind.item.vo.IndItemAtomVO; import com.iailab.module.data.ind.item.vo.IndItemDerVO; import com.iailab.module.data.ind.value.dto.QuerySourceValueDTO; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -29,6 +31,9 @@ @Autowired private IndDataSetService indDataSetService; + + @Autowired + private IndDataSetFieldService indDataSetFieldService; @Autowired private IndItemDerService indItemDerService; @@ -51,7 +56,7 @@ } result.setDataSource(indItem.getDataSource()); StringBuilder selectSql = new StringBuilder(); - IndStatFuncEnum statFun = IndStatFuncEnum.getEumByCode(indItem.getStatFunc()); + IndStatFuncEnum statFun = IndStatFuncEnum.getEumByCode(StringUtils.isBlank(indItem.getStatFunc())? IndStatFuncEnum.DEFAULT.getCode() : indItem.getStatFunc()); switch (statFun) { case AVG: selectSql.append("AVG("); @@ -68,7 +73,7 @@ case SUM: selectSql.append("SUM("); break; - default: + case DEFAULT: selectSql.append("("); break; } @@ -89,8 +94,10 @@ // 拼接SELECT StringBuilder selectSql = new StringBuilder(); - selectSql.append(indItem.getDimension()); - selectSql.append(", "); + if (StringUtils.isNotBlank(indItem.getDimension())){ + selectSql.append(indItem.getDimension()); + selectSql.append(", "); + } selectSql.append(result.getSelectSql()); selectSql.append(", "); selectSql.append(indItem.getTimeLabel()); @@ -174,9 +181,12 @@ whereSql.append("'"); break; case CUSTOM: + 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(DateUtils.format(indItem.getTimeStart(), PATTERN_MON)); whereSql.append("'"); break; -- Gitblit v1.9.3