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>
本文来源:https://www.yuntue.com/post/60458.html | 云服务器网,转载请注明出处!

微信扫一扫打赏
支付宝扫一扫打赏