当前使用版本(必填,否则不予处理)
3.5.1
该问题是如何引起的?(确定最新版也有问题再提!!!)
我在一个if判断中使用 coursePubDao.exists(Wrappers.query(coursePub).eq("id", id)) 其中传入的id在表中已有数据 结果返回false 随后尝试coursePubDao.selectCount(Wrappers.query(coursePub).eq("id", id)); 发现对于传入已存在的id字段返回为 0 <== Columns: COUNT( * ) <== Row: 0 <== Total: 1
我使用 coursePubDao.selectById(id) 可正常查到数据
重现步骤(如果有就写完整)
Integer insert=0; if (coursePubDao.exists(Wrappers.query(coursePub).eq("id", id))) { insert= coursePubDao.updateById(coursePub); }else { insert= coursePubDao.insert(coursePub); }
报错信息
无报错信息
Comment From: jojocodeX
没有发现该问题,可以描述更详细下,方便复现此类问题
Comment From: ChangshengChen7
没有该问题,可以更详细地描述下,方便复现此类问题
我明白了Wrappers.query(coursePub) 默认会加上这个实体类中存在的属性条件 以AND连接去查询 所以导致我后面附加eq条件查询和前面条件一块查询了 导致结果不存在 谢谢