-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
83 additions
and
21 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
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
14 changes: 14 additions & 0 deletions
14
src/main/java/project/backend/domain/keyword/dto/CulturalEventSearchKeywordListDto.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 project.backend.domain.keyword.dto; | ||
|
||
import lombok.*; | ||
|
||
@Getter | ||
@Setter | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class CulturalEventSearchKeywordListDto { | ||
private Long id; | ||
private String keyword; | ||
private Integer ordering; | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/project/backend/domain/keyword/mapper/CulturalEventSearchKeywordMapper.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,16 @@ | ||
package project.backend.domain.keyword.mapper; | ||
|
||
import org.mapstruct.Mapper; | ||
import org.mapstruct.ReportingPolicy; | ||
import project.backend.domain.keyword.dto.CulturalEventSearchKeywordListDto; | ||
import project.backend.domain.keyword.entity.CulturalEventSearchKeyword; | ||
|
||
import java.util.List; | ||
|
||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
public interface CulturalEventSearchKeywordMapper { | ||
List<CulturalEventSearchKeywordListDto> culturalEventSearchKeywordToCulturalEventSearchKeywordListDto( | ||
List<CulturalEventSearchKeyword> culturalEventSearchKeywordList | ||
); | ||
|
||
} |
8 changes: 3 additions & 5 deletions
8
.../java/project/backend/domain/keyword/repository/CulturalEventSearchKeywordRepository.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 |
---|---|---|
@@ -1,17 +1,15 @@ | ||
package project.backend.domain.keyword.repository; | ||
|
||
import io.lettuce.core.dynamic.annotation.Param; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import project.backend.domain.keyword.entity.CulturalEventSearchKeyword; | ||
import project.backend.domain.member.entity.Member; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public interface CulturalEventSearchKeywordRepository extends JpaRepository<CulturalEventSearchKeyword, Long> { | ||
|
||
List<CulturalEventSearchKeyword> findCulturalEventSearchKeywordsByIsRecentFalseAndMember(Member member); | ||
List<CulturalEventSearchKeyword> findByIsRecentTrueAndMemberOrderByUpdatedDateDesc(Member member); | ||
|
||
@Query("SELECT CASE WHEN COUNT(c) > 0 THEN true ELSE false END FROM CulturalEventSearchKeyword c WHERE c.isRecent = false AND c.member = :member AND c.keyword = :keyword") | ||
Boolean existsByIsRecentFalseAndMemberAndKeyword(@Param("member") Member member, @Param("keyword") String keyword); | ||
Optional<CulturalEventSearchKeyword> findFirstByMemberAndKeywordAndIsRecentTrue(Member member, String keyword); | ||
} |
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