background
The project uses mybatis-plus, it needs to traverse a grid array and associate it with or
, but the other conditions outside the array are and
, similar to
select 1 from t where a = 1 and (b like '%2' or b = '%3' or b = '%4')
solution
queryWrapper.and(qw -> {
for (int i = 0; i < values.length; i++) {
String val = values[i];
if (i == 0) {
qw.nested(w -> w.likeRight("b", val));
} else {
qw.or(w -> w.likeRight("b", val));
}
}
});
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。