/**
 * Created by Djidjelly Siclait on 10/2/2016.
 */
package com.evapps.Repository;

import com.evapps.Entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface UserRepository  extends JpaRepository<User, String>{

    User findByUserId(String userId);

    @Query("select u from User u where u.clinic.clinicId = :clinic")
    List<User> findByClinicId(@Param("clinic") String clinicId);

    @Query("select u from User u where u.firstName = :first and u.lastName = :last")
    List<User> findByFullName(@Param("first") String firstName, @Param("last") String lastName);

    @Query("select u from User u where u.email = :email and u.password = :password")
    User findUserAccountWithUsernameAndPassword(@Param("email") String email, @Param("password") String password);

    @Query("select u from User u where u.email = :email and u.password = :password")
    User findUserAccountWithUsernameAndClinicIdAndPassword(@Param("email") String email, @Param("password") String password);

}

@@ -397,22 +397,21 @@
 ndBy
-UserId
+Email
 (String 
 user
@@ -410,149 +410,13 @@
 ing 
-userId);%0A%0A    @Query(%22select u from User u where u.clinic.clinicId = :clinic%22)%0A    List%3CUser%3E findByClinicId(@Param(%22clinic%22) String clinicId
+email
 );%0A%0A
@@ -802,219 +802,6 @@
 d);%0A
-%0A    @Query(%22select u from User u where u.email = :email and u.password = :password%22)%0A    User findUserAccountWithUsernameAndClinicIdAndPassword(@Param(%22email%22) String email, @Param(%22password%22) String password);%0A%0A
 %7D%0A

Refactor User Repository