🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
```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(); } ```