网上不详细?你是在国外上网吗?#就是? $就是拼接select from table where a = #{pa}等价 "select from table where a = ?" select from table where a = ${pa}等价 "select from table where a = "+pa+""
额 先谢谢你的回答。是我将#{user.login_id}放在了%%里面,使用拼接的方式就不会出现这种问题。"select from table where a = %?%" 这是个错误的SQL"select from table where a = '%"+pa+"%'" 这是个正确的SQL正常的用法是: 你的user.login_id就应该是含有%的字符值,把%写到SQL里本身就不是正常的用法
select from table where a = ${pa}等价 "select from table where a = "+pa+""