首页 > 代码库 > ibatis 循环迭代
ibatis 循环迭代
一、指定参数类型为List
<!--iterate不要property属性 -->
<delete id="delStudybook" parameterClass="java.util.List">
delete FROM STUDYBOOK WHERE ID IN
<iterate conjunction="," open="(" close=")">
#bookList[]#
</iterate>
</delete>
二、不制定参数
<!--iterate不要property属性 传入的参数为数组-->
<select id="checkAccount_count" resultClass="java.lang.Integer">
select count(*) from dbms_bankAccount b where 1=1 and b.accountno in
<iterate open="(" close=")" conjunction=",">
#[]#
</iterate>
</select>
三、必须要property
<update id="updateUsersIterate" parameterClass="java.util.Map">
update users set user_name=#userInfo.user_name# where user_id in
<iterate property="list" conjunction="," open="(" close=")">
#list[]#
</iterate>
</update>
<select id="sql_test" parameterclass="myPramBean" resultclass="myResult">
select *from tablewhere name in
<iterate property="ids" conjunction="," close=")" open="(" />
#ids[]#
</iterate>
and code=#code#
</select>
ibatis 循环迭代