1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| @ApiOperation("查询分页") @GetMapping(value = "/findTypeList") public Object findAllByPage(LineUpServerFieldSearchModel searchVo) { Map<String, List<Map<String, Object>>> fieldTypeMap = new HashMap<>(); List<Map> list = lineUpServerFieldService.findByList(searchVo); for (Map<String, Object> record : list) { String fieldType = record.get("fieldType").toString(); if (!fieldTypeMap.containsKey(fieldType)) { fieldTypeMap.put(fieldType, new ArrayList<>()); } fieldTypeMap.get(fieldType).add(record); } Map<String, List<Map<String, Object>>> sortedFieldTypeMap = fieldTypeMap.entrySet() .stream() .sorted((e1, e2) -> Integer.compare( Integer.parseInt(e1.getKey()), Integer.parseInt(e2.getKey()) )) .collect(Collectors.toMap( Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new )); return sortedFieldTypeMap; }
|