当mybatis中需要查询in这种sql时候 ,需要使用 foreach 标签
使用 分隔符将 in(23,13,233)拼接起来,如下 open="(" separator="," close=")"
sql如下:
<select >
#{id}
</foreach>
and status != 0
</select>
调用时候代码:
List<StudentDAO>
selectStudentInfoByIds (List<Integer> ids);
当mybatis中需要查询in这种sql时候 ,需要使用 foreach 标签
使用 分隔符将 in(23,13,233)拼接起来,如下 open="(" separator="," close=")"
sql如下:
<select >
#{id}
</foreach>
and status != 0
</select>
调用时候代码:
List<StudentDAO>
selectStudentInfoByIds (List<Integer> ids);
相关文章: