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>

猜你喜欢

转载自www.cnblogs.com/liujianwang/p/8981024.html