csjoz11

导航

lambda表达式取单列的值

QueryWrapper<Empbole2> empbole2QueryWrapper = new QueryWrapper<>();
empbole2QueryWrapper.eq("emp_job","离职");
List<Empbole2> userList = empbole2Service.list(empbole2QueryWrapper);
List<String> userList2 = new ArrayList<>();
userList2 = userList.stream().map(e -> e.getUserId()).collect(Collectors.toList());

//数据以逗号拼接

ArrayList<String> strings = new ArrayList<>();
strings.add("11111");
strings.add("2222");
strings.add("11133311");
strings.add("444444");

StringBuffer sb = new StringBuffer();

strings.stream().forEach(str->{
    sb.append(str).append(",");
});

System.out.println(sb);

posted on 2023-09-18 16:46  csjoz11  阅读(9)  评论(0编辑  收藏  举报