List<TrainEvaluateBo> peopleList = getBaseMapper().queryNeedToStrengthen(vo); //获取学习完成时间最高的前三数据 List<Long> collect = peopleList.stream().filter(item -> null != item.getStudyCompTime()) .collect(Collectors.groupingBy(TrainEvaluateBo::getStudyCompTime)).entrySet() .stream().sorted((s1, s2) -> -Double.compare(s1.getKey(), s2.getKey())).limit(3).map(v -> v.getKey()).collect(Collectors.toList()); //获取错误次数最低的前三数据 List<Integer> collect1 = peopleList.stream().filter(item -> null != item.getNumberOfError()) .collect(Collectors.groupingBy(TrainEvaluateBo::getNumberOfError)).entrySet() .stream().sorted((s1, s2) -> Integer.compare(s1.getKey(),s1.getKey())).limit(3).map(v -> v.getKey()).collect(Collectors.toList()); //获取一次性正确率最高的前三数据 List<Double> collect2 = peopleList.stream().filter(item -> null != item.getOneTimeRate()) .collect(Collectors.groupingBy(TrainEvaluateBo::getOneTimeRate)).entrySet() .stream().sorted((s1, s2) -> -Double.compare(s1.getKey(), s2.getKey())).limit(3).map(v -> v.getKey()).collect(Collectors.toList());
根据指定字段获取前三数据
最新推荐文章于 2023-11-02 20:02:48 发布