我想利用mybatis的example类生成如下的sql语句:
SELECT * FROM User where nick_name like "%1502%" or real_name like "%1502%" or mobile like "%1502%"
我本来是这样使用的:
UserExample userExample = new UserExample();
UserExample.Criteria userCriteria = userExample.createCriteria();
userExample.or().andMobileLike("%1502%");
userExample.or().andRealNameLike("%1502%");
userExample.or().andNickNameLike("%1502%");
return userService.selectByExample(userExample);
但是这样使用并不能返回我想要的结果,它会把所有的User数据全部返回完全没有加入or限制笑哭
求大神指教
试试这个?