之前寫過一篇關於 in 與 not in 問題的文章(結合 Mybatis,探討 Oracle 中 in 與 not in 的陷阱),現在在擴展一下,談談 Mybatis Plus 單表操作時 in(not in) 的相關問題。
先用一個簡單的例子說明下問題,比如我們要查一年級所有同學的信息。經常會有下面這樣的寫法:
// 獲取班級ID集合
List<String> classIdList = classMapper.selectList().stream()
.map(Class::getClassId)
.collect(Collectors.toList());
// 獲取學生信息
List<Student> studentL