赵沛松吧 关注:7贴子:67
  • 2回复贴,共1

MySQL FIND_IN_SET(字段名,"1,2,3")

只看楼主收藏回复

分组后取每组时间最大的一条数据
try {
list = stockFlowDao.searchStockFlowMaxInTime(partsIds);
if (list.size() > 0 && list.get(0) != null){
Map<Long, List<StockFlowMaxInTimeVo>> longListMap = list.stream().collect(Collectors.groupingBy(StockFlowMaxInTimeVo::getStockId));
list=new ArrayList<>();
Set<Long> longs = longListMap.keySet();
for (Long aLong : longs) {
Optional<StockFlowMaxInTimeVo> inTimeVoOptional = longListMap.get(aLong).stream().max(Comparator.comparing(StockFlowMaxInTimeVo::getInTime));
list.add(inTimeVoOptional.get());
}
}
} catch (Exception e) {
e.printStackTrace();
}



IP属地:北京来自Android客户端1楼2021-11-12 23:13回复


    IP属地:北京来自Android客户端2楼2021-11-12 23:37
    回复


      IP属地:北京来自Android客户端3楼2021-11-16 23:22
      回复