Mybatis查询实例,sql中的in在Mybatis中怎么写
2个回答
展开全部
<select id="findByIdsMap" resultMap="BaseResultMap">
Select *
from tb1 where ID in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="findByIdsMap" resultMap="BaseResultMap">
select *
from tb1 where ID in
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</select>
根据参数类型进行选择
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询