标签:
在mybatis 传入数组在sql语句中进行查询
1.传入一个map集合,已或者的形式拼接数组循环
<select id="selectUserByList" parameterClass="HashMap" resultClass="UserInfo"> select * from user <dynamic prepend="WHERE"> <isNotNull property="userId"> <iterate property="userId" conjunction=" or " close=")" open="("> userId = #userId[]# </iterate> </isNotNull> </dynamic> </select>
2.1.传入一个map集合,使用in() 关键字
<delete id="del" parameterClass="HashMap"> DELETE FROM user WHERE userId in <iterate property="userIds" conjunction="," open="(" close=")"> #userIds[]# </iterate> </delete>
标签:
原文地址:http://www.cnblogs.com/mytzq/p/4773103.html