原生的SQL:

select * from t_user where sex='male' 
and ((name=ylw and age=18) or (name=dumas and age=20));

MyBatisPlus 写法:

QueryWrapper<User> userQueryWrapper = new QueryWrapper<>();
userQueryWrapper.eq("sex","male");
userQueryWrapper.and(wrapper ->{
    wrapper.and(nameAgeQueryWrapper ->{
        nameAgeQueryWrapper.or(itemWrapper ->{
            itemWrapper.eq("name","ylw");
            itemWrapper.eq("age",18);
        });
        nameAgeQueryWrapper.or(itemWrapper ->{
            itemWrapper.eq("name","dumas");
            itemWrapper.eq("age",20);
        });
    });
});
List<User> user = mapper.selectList(queryWrapper);