mybatis如何拼接sql注入
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>