-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from UdL-EPS-SoftArch/crud-Favourite
crud-favourite
- Loading branch information
Showing
2 changed files
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,6 @@ public class FavouritedPets extends UriEntity<Long> { | |
@NotNull | ||
Long id; | ||
|
||
String userId; | ||
Long petId; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/cat/udl/eps/softarch/demo/repository/FavouritedPetsRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package cat.udl.eps.softarch.demo.repository; | ||
|
||
import cat.udl.eps.softarch.demo.domain.FavouritedPets; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.data.repository.PagingAndSortingRepository; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import java.util.List; | ||
|
||
public interface FavouritedPetsRepository extends CrudRepository<FavouritedPets, Long>, PagingAndSortingRepository<FavouritedPets, Long> { | ||
List<FavouritedPets> findByPetId(@Param("petId") Long petId); | ||
List<FavouritedPets> findByUserId(@Param("userId") String userId); | ||
List<FavouritedPets> findByUserIdAndPetId(@Param("userId") String userId,@Param("petId") Long petId); | ||
} |