第一种解决:根据Map查询

测试:

@Test
public void test08(){
  Student stu = new Student("田七",27,95);
  Map<String, Object> map = new HashMap<>();
  map.put("nameCon", "张");
  map.put("ageCon",18);
  map.put("stu", stu);
  List<Student> students = dao.selectStudentsByCondition(map);
  for (Student student : students) {
    System.out.println(student);
  }

}

dao:

mapper:

第二种方法:使用索引号

测试:

mapper:

dao: