赞
踩
目标sql为:
select
user_name , user_type , user_class , user_age
from user
where
user_type = ‘1’
and (
(user_accountno = ? and user_bankname = ?)
or
(user_accountno = ? and user_bankname = ?)
);
【问题:条件是一个List需要循环时,怎么使用QueryWrapper?】
【注意一下几点】:
【结果】
QueryWrapper<User> queryWrapper = new QueryWrapper<User>();
queryWrapper.and(wrapper -> {
for(BankInfo info: bankinfoList){
wrapper.or()
.eq("user_accountno",info.getAccountNo())
.eq("user_bankname",info.getBankName());
}
});
List<User> users = userMapper.selectList(queryWrapper);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。