|
|
|
@ -164,7 +164,7 @@ public class TestXiaoTuPuController extends BaseController { |
|
|
|
return a; |
|
|
|
} |
|
|
|
@GetMapping("getReInfoByNameAndType/{name}/{type}") |
|
|
|
public List<Map> selectPointRelationshipByName(@PathVariable("name")String name,@PathVariable("type")String type) throws IOException { |
|
|
|
public List<Map<String, List<Map<String, Object>>>> selectPointRelationshipByName(@PathVariable("name")String name,@PathVariable("type")String type) throws IOException { |
|
|
|
String author = ""; |
|
|
|
String keyword = ""; |
|
|
|
String agency = ""; |
|
|
|
@ -182,8 +182,26 @@ public class TestXiaoTuPuController extends BaseController { |
|
|
|
title = name; |
|
|
|
} |
|
|
|
|
|
|
|
List<Map> a = zhyPointMapper.selectPointRelationshipByName(author,keyword,agency,title); |
|
|
|
return a; |
|
|
|
// 1. 查询
|
|
|
|
List<Map> records = zhyPointMapper.selectPointRelationshipByName(author,keyword,agency,title); |
|
|
|
|
|
|
|
// 2. 按 title 分组
|
|
|
|
Map<String, List<Map<String, Object>>> grouped = new HashMap<>(); |
|
|
|
for (Map record : records) { |
|
|
|
if (record == null) continue; |
|
|
|
String title1 = Objects.toString(record.get("title"), "unknown"); |
|
|
|
grouped.computeIfAbsent(title1, k -> new ArrayList<>()).add(record); |
|
|
|
} |
|
|
|
|
|
|
|
// 3. 转为 List<Map<String, List<Map>>>
|
|
|
|
List<Map<String, List<Map<String, Object>>>> result = new ArrayList<>(); |
|
|
|
for (String title1 : grouped.keySet()) { |
|
|
|
Map<String, List<Map<String, Object>>> map = new HashMap<>(); |
|
|
|
map.put(title1, grouped.get(title1)); |
|
|
|
result.add(map); |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|