mybatis判断集合非空

List<xx> getList(@Param("list")List<String> list); 

<select id="getList" resultType="xx">

select * from t_xx where 1=1

<if test="list != null and list.size() > 0 ">
    and xxxx in 
    <foreach collection="list" close=")" open="(" item="item" separator=",">
        #{item}
    </foreach>
</if>

</select>


版权声明:本文为iamlzyoco原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。