当前位置:Gxlcms > 数据库问题 > sqlMap.xml配置文件中迭代一个集合的方式

sqlMap.xml配置文件中迭代一个集合的方式

时间:2021-07-01 10:21:17 帮助过:3人阅读

" open="(" separator="," close=")">

    #{classList}      [item是一个别名而已]

  </foreach>

</select>

2、criteria的用法:【写法二】

 

 <isNotEmpty property="criteria">
   <iterate property="criteria" conjunction="and" prepend="and"
 open="(" close=")">
    $criteria[].paramName$ $criteria[].arithmeticType$ #criteria[].paramValue#
 </iterate>

JAVA测试方法编写:(接口声明)

 public List<Student> getStudentListByClassId(List<String> classList);

测试代码,查询学生中在10000,10001这两个班级的学生:(具体实现方法)

  List<String> classList = new ArrayList<String>();

  classList.add("10000");

  classList.add("10001");

  List<Student> studentList = studentMapper.getStudentListByClassId(classList);

  for(Student stu:studentList){

    System.out.println(studentList.toString());

  }

 

sqlMap.xml配置文件中迭代一个集合的方式

标签:

人气教程排行