企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
```java public interface UserRepository extends JpaRepository<User, Integer>, JpaSpecificationExecutor<User> { // ?1 ?是占位符,1是方法参数的索引,从1开始 @Query("select u from User u where u.email = ?1") User getByEmail(String eamil); @Query("select u from User u where u.username = ?1 and u.password = ?2") User getByUsernameAndPassword(String username, String password); @Query("select u from User u where u.username like %?1%") List<User> getByUsernameLike(String username); //可以省略select,直接写from @Query(value="from User") public List<User> findAllUser(); } ```