基本使用:
使用方法一:
UserExample example = new UserExample();
Criteria criteria = example.createCriteria();
criteria.andUsernameEqualTo("wyw");
criteria.andUsernameIsNull();
example.setOrderByClause("username asc,email desc");
List<?>list = XxxMapper.selectByExample(example);
//相当于:select * from user where username = 'wyw' and username is null order by username asc,email desc
使用方法二:
UserExample example = new UserExample();
example.or().andxxxx();
更多资料:
1、MyBatis的Mapper接口以及Example的实例函数及详解
https://blog.youkuaiyun.com/biandous/article/details/65630783
2、 [mybatis]Example的用法
https://blog.youkuaiyun.com/zhemeban/article/details/71901759
本文介绍了MyBatis中Example的两种使用方法,包括创建条件、设置排序等操作,通过具体示例展示了如何进行数据库查询。
563

被折叠的 条评论
为什么被折叠?



