| | |
| | | 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 |
| | |
| | | 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("'"); |
| | |
| | | |
| | | // 拼接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; |
| | | } |
| | | |