使用Mybatis Plus的QueryWrapper实现如下的sql语句效果:
select * from xxx where field1= ? and (field2= ? or field3= ?)
Mybatis Plus代码:
QueryWrapper<xxx> queryWrapper = new QueryWrapper<xxx>(); queryWrapper.eq(field1, field1Value); queryWrapper.and(wrapper -> wrapper.eq(field2, field2Value).or().eq(field3, field3Value));