mybatis如何拼接sql注入

lewis 2018-11-14 22次阅读

mybatis拼接sql注入的方法:

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

<selectid="dynamicIfTest"parameterType="Blog"resultType="Blog">

select*fromt_blogwhere11=1

<iftest="title!=null">

andtitle=#{title}

</if>

<iftest="content!=null">

andcontent=#{content}

</if>

<iftest="owner!=null">

andowner=#{owner}

</if>

</select>




发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。