mybatis-plus 中 queryWrapper and与or嵌套
(…and …) or (…and …) 格式
QueryWrapper<entity> query = new QueryWrapper<>();
query.and(wrapper->wrapper.eq("SEND_USER_ID",sendUserId).eq("RECEIVE_USER_ID",receiveUserId))
.or(wrapper->wrapper.eq("SEND_USER_ID",receiveUserId).eq("RECEIVE_USER_ID",sendUserId));
效果
sql: 条件组成
WHERE ((SEND_USER_ID = ? AND RECEIVE_USER_ID = ?) OR (SEND_USER_ID = ? AND RECEIVE_USER_ID = ?))