MyBatis的mapper.xml中判断集合的size

<if test="codeList != null and codeList.size &gt; 0">
    AND code IN 
    <foreach collection="codeList" item="code" open="(" separator=","  close=")">
        #{code}
    </foreach>
</if>

 

posted @ 2018-05-02 16:36  行舟逐梦  阅读(1154)  评论(0编辑  收藏  举报