mybatis实现in查询,两种方法:

  • xml形式(推荐)
  • 注解方式(个人喜欢注解,但是in场景可能不太适合注解)

代码:

1     @Select("<script>"
2               + "SELECT IDFA FROM t_xxx WHERE IDFA IN "
3               + "<foreach item='item' index='index' collection='strList' open='(' separator=',' close=')'>"
4                   + "#{item}"
5               + "</foreach>"
6           + "</script>")
7     @Results(value = { @Result(column = "user_name", property = "username") })
8     public List<String> getXxxList(@Param("strList") List<String> strList);
View Code

相关文章:

  • 2022-12-23
  • 2021-08-06
  • 2022-12-23
  • 2021-11-20
  • 2021-12-06
猜你喜欢
  • 2022-12-23
  • 2022-01-24
  • 2022-12-23
  • 2021-12-13
  • 2021-11-20
  • 2022-12-23
  • 2021-10-31
相关资源
相似解决方案