ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
可以使用`@Param`注解为方法参数指定具体名称并在查询中绑定名称。 ```java public interface UserRepository extends JpaRepository<User, Integer>, JpaSpecificationExecutor<User> { @Query("select u from User u where u.id = :id") User getById(@Param("id") String userId); @Query("select u from User u where u.username = :username or u.email = :email") User getByUsernameOrEmail(@Param("username") String username, @Param("email") String email); } ```