mybatis

判断list是否为空

<where>
            <if test="CodeList!=null and CodeList.size > 0">
                loc.eb_code in
                <foreach collection="locationCodeList" item="Code" open="(" separator="," close=")">
                    #{Code}
                </foreach>
            </if>
            <if test="queryVo.level != null  ">
                and loc.eb_level = #{queryVo.level}
            </if>
            and arg.is_deleted = 0
        </where>

 mybatis 写<where> 可以判断是否是第一个条件,不用写where 1=1 

posted on 2022-02-24 17:50  sunshineicy  阅读(15)  评论(0编辑  收藏  举报

导航