sql中#与$取值

在mapper.xml中#与$都是用来取值的

<update id="addUrl">
    update user_power set url = #{newurl} where role = 'ROLE_${role}';
</update>

$取值会直接拼接在sql中,不能防止sql注入,

#取值的话会不论你传的是什么都不会被sql解析

 

posted @ 2019-08-27 14:04  上官墨子猪  阅读(444)  评论(0编辑  收藏  举报