@Test void testInSQL(){ QueryWrapper<User> wrapper = new QueryWrapper<>(); wrapper.inSql("id", "select id from tb_user where id < 10"); wrapper.inSql("age", "select age from tb_user where age > 3"); System.out.println(userMapper.selectList(wrapper)); }
sql语句如下
SELECT id,username,password,name,age,email,create_time,update_time,version,status,parentage,del FROM tb_user WHERE del=0 AND (id IN (select id from tb_user where id < 10) AND age IN (select age from tb_user where age > 3))