# 动态 SQL IF 语句

<!--    动态 SQL-->
    <select id="queryBlogIF" parameterType="map" resultType="B">
        select * from blog where 1=1
        <!-- 如果 title 不为 null 则拼接以下语句 -->
        <if test="title != null">
            and title = #{title}
        </if>
        <!-- 如果 author 不为 null 则拼接以下语句 -->
        <if test="author != null">
            and author = #{author}
        </if>
    </select>