mybaties中在xml中map添加一个list中的判断

时间:2022-06-28 20:34:52
 if (uIds.size() > 0) {
map.put("uIds", uIds);
} else {
map.put("uIds", null);
}
 <select id="queryCourseEvaluationPeopleByUIds" resultType="map" resultMap="BaseResultMap">
select * from t_se_course_comment
<where>
<if test="map.kid!=null and map.kid!=''">
and course_id = #{map.kid}
</if>
<if test="map.uIds!=null">
and evaluation_teacher in
<foreach collection="map.uIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if> </where>
order by id ASC
</select>