QueryWrapper一次查询只能用一个
用同一个QueryWraper,下一次查询会在上一个条件的基础上增加条件查询 导致查不出数据
单次查询正常返回数据
QueryWrapper<Employee> queryWrapper = new QueryWrapper<>();
List<Employee> employees = employeeService.list(queryWrapper.eq("did", 1));
多次查询只能查到第一次的数据
QueryWrapper<Employee> queryWrapper = new QueryWrapper<>();
int[] ids = {1, 2, 3};
for (int i = 0; i < ids.length; i++) {
System.out.println(ids[i]);
List<Employee> employees = employeeService.list(queryWrapper.eq("did", ids[i]));
System.out.println(employees);
}
结果【有数据】【空】【空】