温馨提示×

mybatis如何拼接sql注入

小新
291
2021-02-05 08:11:02
栏目: 云计算

mybatis如何拼接sql注入

mybatis拼接sql注入的方法:

利用if语句实现,xml代码如下。

<select id="dynamicIfTest" parameterType="Blog" resultType="Blog">  

    select * from t_blog where 11 = 1  

    <if test="title != null">  

        and title = #{title}  

    </if>  

    <if test="content != null">  

        and content = #{content}  

    </if>  

    <if test="owner != null">  

        and owner = #{owner}  

    </if>  

</select>


0