我是靠谱客的博主 聪明乌冬面,这篇文章主要介绍MyBatis 使用数组作为参数,现在分享给大家,希望可以做个参考。

<select id="findDataByCodes" resultMap="BaseResultMap" >
    select
    <include refid="this_list" />
    from EDIIS_BLACK_LIST_UNIT t
    where 1=1
    <if test="array !=null and array.length > 0">
      and t.code in
        <foreach collection="array" item = "code" open="(" separator="," close=")" index="index">
            #{code}
        </foreach>

    </if>
</select>

切记,上面一个小问题搞了我几个小时,当用数组作为参数时候,参数名必须为“array”

最后

以上就是聪明乌冬面最近收集整理的关于MyBatis 使用数组作为参数的全部内容,更多相关MyBatis内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(142)

评论列表共有 0 条评论

立即
投稿
返回
顶部