mybatis 中foreach传入的是对像List时怎么办
1个回答
展开全部
看例子
<delete id = "delRightsByID" parameterType = "java.util.Map">
<![CDATA[
delete from ${companyNum}.T_RIGHT where RIGHT_ID in
]]>
<foreach collection="data" item ="right" open="(" separator="," close=")">
#{right.rightId, jdbcType=DECIMAL}
</foreach>
</delete>
这个是MAP, 如果是List , parameterType = "java.util.List" collection="list" 就行了
<delete id = "delRightsByID" parameterType = "java.util.Map">
<![CDATA[
delete from ${companyNum}.T_RIGHT where RIGHT_ID in
]]>
<foreach collection="data" item ="right" open="(" separator="," close=")">
#{right.rightId, jdbcType=DECIMAL}
</foreach>
</delete>
这个是MAP, 如果是List , parameterType = "java.util.List" collection="list" 就行了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询