iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/IndItemCollector.java
@@ -48,7 +48,7 @@ result = atomItemHandler.queryValue(indItem.getId()); break; case DER: result = derItemHandler.queryValue(itemNo); result = derItemHandler.queryValue(indItem.getId()); break; case CAL: result = calItemHandler.queryValue(itemNo); iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/utils/IndSqlUtils.java
@@ -97,11 +97,13 @@ if (StringUtils.isNotBlank(indItem.getDimension())){ selectSql.append(indItem.getDimension()); selectSql.append(", "); selectSql.append(result.getSelectSql()); }else{ selectSql.append(result.getSelectSql()); selectSql.append(", "); selectSql.append(indItem.getTimeLabel()); selectSql.append(" data_time"); } selectSql.append(result.getSelectSql()); selectSql.append(", "); selectSql.append(indItem.getTimeLabel()); selectSql.append(" data_time"); result.setSelectSql(selectSql.toString()); // 拼接WHERE @@ -153,7 +155,9 @@ 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); whereSql.append(DateUtils.format(calendar.getTime(), PATTERN_MON)); whereSql.append("'"); @@ -197,14 +201,17 @@ // 拼接GROUP StringBuilder groupSql = new StringBuilder(); groupSql.append(" GROUP BY "); groupSql.append(indItem.getDimension()); if (StringUtils.isNotBlank(indItem.getDimension())){ groupSql.append(indItem.getDimension()); } result.setGroupSql(groupSql.toString()); // 拼接ORDER StringBuilder orderBySql = new StringBuilder(); orderBySql.append(indItem.getTimeLabel()); result.setOrderBySql(orderBySql.toString()); if (StringUtils.isNotBlank(indItem.getDimension()) && indItem.getDimension().equals(indItem.getTimeLabel())){ orderBySql.append(indItem.getTimeLabel()); result.setOrderBySql(orderBySql.toString()); } return result; } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/value/dao/IndItemValueDao.java
@@ -3,6 +3,7 @@ import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.mybatis.core.mapper.BaseMapperX; import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; import com.iailab.framework.tenant.core.aop.TenantIgnore; import com.iailab.framework.tenant.core.db.dynamic.DataDS; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.data.ind.item.vo.IndItemValueVO; @@ -30,5 +31,6 @@ .orderByDesc(IndItemValueEntity::getDataTime)); } @DataDS @TenantIgnore List<IndItemValueVO> getSourceValue(QuerySourceValueDTO dto); } iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/ind/IndItemValueDao.xml
@@ -14,6 +14,9 @@ and ${whereSql} </if> </where> <if test="groupSql != null and groupSql != ''"> group by ${groupSql} </if> <if test="orderBySql != null and orderBySql != ''"> order by ${orderBySql} </if>