MyBatis 传入List集合作为条件查询数据
xx.xml
<select id="getProjectByCode" parameterType="java.util.List" resultMap="BaseResultMap">
select t1.CODE,t1.NAME,t2.PROJECT_NAME as projectName,t2.TEST_CATEGORY as testCategory,t2.CHECK_TEST_ITEM as checkTestItem
from t_qms_check_project t1 LEFT JOIN t_qms_check_project_details t2 on t1.ID = t2.CHECK_PROJECT_ID
where code in
<foreach collection="list" item="list" index="index" open="(" separator="," close=")">
#{list}
</foreach>
</select>
xxmapper.java
List<Project> getProjectByCode(List<String> list);
xxcontroller.java
@GetMapping(value = "getProjectByCode")
public List<Project> getProjectByCode(@RequestParam(value = "list") List<String> list){
return projectService.getProjectByCode(list);
}