错误示例
//错误案例 使用?时,list<long>没法进行正确的转义
@Query(value = "select * from User where Id in (?)", nativeQuery = true)
List<User> userByIds(List<Long> ids);
//sql输出示例 select * from User where Id in ([111, 222])
正确示例
//使用@Param指定 交给JPA自动换义
@Query(value = "select * from User where Id in (:ids)", nativeQuery = true)
List<User> listByStageIds(@Param("ids") List<Long> ids);
//sql输出示例 select * from User where Id in (111, 222)