|
@@ -14,10 +14,8 @@ import com.querydsl.core.types.dsl.BooleanExpression;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.LinkedList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Optional;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author fengyanjie
|
|
@@ -113,16 +111,29 @@ public class ReportConfigService implements BaseService {
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
- public MapResponse groupbyColumns(String tableName) {
|
|
|
+ public MapResponse groupbyColumns(List<String> tableNameList) {
|
|
|
MapResponse response = new MapResponse();
|
|
|
- String groupbyColumns = reportConfigRepository.groupbyColumns(tableName);
|
|
|
- response.add("data", groupbyColumns.split(","));
|
|
|
+ List<String> list = reportConfigRepository.groupbyColumns(tableNameList);
|
|
|
+ List<String> intersection = new ArrayList<>();
|
|
|
+ for (String groupbyColumns : list) {
|
|
|
+ List<String> group = Arrays.asList(groupbyColumns.split(","));
|
|
|
+ if (group.size() == 0) {
|
|
|
+ intersection.clear();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (intersection.size() == 0) {
|
|
|
+ intersection.addAll(group);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ intersection = intersection.stream().filter(item -> group.contains(item)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ response.add("data", intersection);
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
- public MapResponse calculated(String tableName) {
|
|
|
+ public MapResponse calculated() {
|
|
|
MapResponse response = new MapResponse();
|
|
|
- List<String> calculated = reportConfigRepository.calculated(tableName);
|
|
|
+ List<String> calculated = reportConfigRepository.calculated();
|
|
|
response.add("data", calculated);
|
|
|
return response;
|
|
|
}
|