我的userIdList中有四个集合,一个集合中有4个id,那么一共是16个id, 我想做到的是 queryWrapper.in("create_user",16个id都查,或者的关系,只要存在一个就展示)
for (Dept dept : deptIdList){
List<User> userList = dataPermissionUtils.userMapper.selectUserIdList(dept.getId());
resultList.addAll(list.stream().map(User::getId).collect(Collectors.toList()));
}
大概就是这个意思,你在根据部门id查出该部门的同时,直接遍历出userList 的id,插入resultList中
最后resultList应该就是一个有16个元素的列表
[1,2,3,4,...,16]
提供一个思路给您,您可以把这四个List的Id集合给合并然后去重,再查询就好了
直接 判断list的size,大于0都展示, 类似于 where ...and if(size>0,1=1,1=0)
List<List<xxxxEntity>> list = new ArrayList<>();
List<Long> ids = new ArrayList<>();
list.forEach(x ->
x.forEach(y -> ids.add(y.getId()))
);