11package com .closetnangam .be .domain .clothes .repository ;
22
33import com .closetnangam .be .domain .clothes .entity .WardrobeClothes ;
4- import com .closetnangam .be .domain .clothes .enums .SourceType ;
4+ import com .closetnangam .be .domain .clothes .enums .OwnershipStatus ;
55import org .springframework .data .jpa .repository .JpaRepository ;
66import org .springframework .data .jpa .repository .Query ;
77import org .springframework .data .repository .query .Param ;
@@ -14,44 +14,35 @@ public interface WardrobeClothesRepository extends JpaRepository<WardrobeClothes
1414 @ Query ("""
1515 select distinct wc from WardrobeClothes wc
1616 join fetch wc.clothes c
17- left join fetch c.colorTags
18- left join fetch c.styleTags st
19- left join fetch st.style
2017 join fetch wc.wardrobe w
2118 join fetch w.user
2219 where w.user.id = :userId
23- and c.sourceType = :sourceType
20+ and wc.ownershipStatus = :ownershipStatus
2421 order by c.createdAt desc
2522 """ )
26- List <WardrobeClothes > findAllByUserIdAndSourceType (
23+ List <WardrobeClothes > findAllByUserIdAndOwnershipStatus (
2724 @ Param ("userId" ) Long userId ,
28- @ Param ("sourceType " ) SourceType sourceType
25+ @ Param ("ownershipStatus " ) OwnershipStatus ownershipStatus
2926 );
3027
3128 @ Query ("""
3229 select distinct wc from WardrobeClothes wc
3330 join fetch wc.clothes c
34- left join fetch c.colorTags
35- left join fetch c.styleTags st
36- left join fetch st.style
3731 join fetch wc.wardrobe w
3832 join fetch w.user
3933 where w.user.id = :userId
40- and c.sourceType = :sourceType
34+ and wc.ownershipStatus = :ownershipStatus
4135 and wc.favorite = true
4236 order by wc.updatedAt desc
4337 """ )
44- List <WardrobeClothes > findFavoritesByUserIdAndSourceType (
38+ List <WardrobeClothes > findFavoritesByUserIdAndOwnershipStatus (
4539 @ Param ("userId" ) Long userId ,
46- @ Param ("sourceType " ) SourceType sourceType
40+ @ Param ("ownershipStatus " ) OwnershipStatus ownershipStatus
4741 );
4842
4943 @ Query ("""
5044 select wc from WardrobeClothes wc
5145 join fetch wc.clothes c
52- left join fetch c.colorTags
53- left join fetch c.styleTags st
54- left join fetch st.style
5546 join fetch wc.wardrobe w
5647 join fetch w.user
5748 where c.id = :clothesId
0 commit comments