爱生活,爱分享


mybatis判断集合非空

haiten 2023-02-08 980浏览 0条评论
首页/正文
分享到: / / / /
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>

原文链接:mybatis判断集合非空

转载仅为方便学习查看,一切权利属于原作者,本人只是做了整理和排版,如果带来不便请联系我删除。

最后修改:2023-02-08 14:34:36 © 著作权归作者所有
如果觉得我的文章对你有用,请随意赞赏
扫一扫支付

上一篇

发表评论

说点什么吧~

评论列表

还没有人评论哦~赶快抢占沙发吧~