学无先后,达者为师

网站首页 编程语言 正文

mybatis if 并且判断列表是否为空

作者:NoOne-csdn 更新时间: 2022-04-01 编程语言
 <select id="getres" parameterType="java.util.List"
            resultType="……RiskFeature">
        select
        *
        from
        f
        where g.is_deleted=0
        <if test="items != null and items.size()>0">
            and f.source_hive_info in
            <foreach collection="items" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="items == null or  items.size()==0">
          limit 10
        </if>
    </select>

原文链接:https://blog.csdn.net/weixin_40161254/article/details/117258265

栏目分类
最近更新