可以使用ne方法实现:

QueryWrapper<Entity> queryWrapper = new QueryWrapper<>();
queryWrapper.ne("fieldA", "fieldB");
List<Entity> entityList = entityMapper.selectList(queryWrapper);

其中,fieldA和fieldB是实体类中的两个属性,entityMapper是MybatisPlus生成的Mapper接口。ne方法表示不等于。

mybatisplus QueryWrapper 查询字段A不等于字段B的记录

原文地址: https://www.cveoy.top/t/topic/cOGe 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录