Mybatis 自动生成的 Example 类的使用方法

基本使用:

使用方法一:

UserExample example = new UserExample();
Criteria criteria = example.createCriteria();
criteria.andUsernameEqualTo("wyw");
criteria.andUsernameIsNull();
example.setOrderByClause("username asc,email desc");
Listlist = 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.csdn.net/biandous/article/details/65630783

2、 [mybatis]Example的用法
https://blog.csdn.net/zhemeban/article/details/71901759


你可能感兴趣的:(MyBatis-基础)