1 种:在 Java 代码中添加 sql 通配符。

string wildcardname = “%smi%”;

list<name> names = mapper.selectlike(wildcardname);

<select id=”selectlike”>

select * from foo where bar like #{value}

</select>

2 种:在 sql 语句中拼接通配符,会引起 sql 注入

string wildcardname = “smi”;

list<name> names = mapper.selectlike(wildcardname);

<select id=”selectlike”>

select * from foo where bar like "%"#{value}"%"

</select>

相关文章:

  • 2021-08-15
  • 2021-06-29
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2021-09-03
  • 2021-08-07
  • 2021-06-23
猜你喜欢
  • 2022-12-23
  • 2021-08-07
  • 2022-03-01
  • 2022-12-23
  • 2022-12-23
  • 2022-02-01
  • 2021-08-04
相关资源
相似解决方案