fix(banner): ChatCharacterBanner 엔티티의 isActive 속성 참조 오류 수정
- 사용하지 않는 메서드 제거
This commit is contained in:
parent
c729a402aa
commit
81f972edc1
|
@ -1,7 +1,6 @@
|
|||
package kr.co.vividnext.sodalive.admin.chat.character.dto
|
||||
|
||||
import kr.co.vividnext.sodalive.chat.character.ChatCharacter
|
||||
import org.springframework.data.domain.Page
|
||||
|
||||
/**
|
||||
* 캐릭터 검색 결과 응답 DTO
|
||||
|
@ -27,9 +26,5 @@ data class ChatCharacterSearchResponse(
|
|||
tags = tags
|
||||
)
|
||||
}
|
||||
|
||||
fun fromPage(characters: Page<ChatCharacter>, imageHost: String): Page<ChatCharacterSearchResponse> {
|
||||
return characters.map { from(it, imageHost) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package kr.co.vividnext.sodalive.admin.chat.dto
|
||||
|
||||
import kr.co.vividnext.sodalive.chat.character.ChatCharacterBanner
|
||||
import org.springframework.data.domain.Page
|
||||
|
||||
/**
|
||||
* 캐릭터 배너 응답 DTO
|
||||
|
@ -21,10 +20,6 @@ data class ChatCharacterBannerResponse(
|
|||
characterName = banner.chatCharacter.name
|
||||
)
|
||||
}
|
||||
|
||||
fun fromPage(banners: Page<ChatCharacterBanner>, imageHost: String): Page<ChatCharacterBannerResponse> {
|
||||
return banners.map { from(it, imageHost) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,43 +1,13 @@
|
|||
package kr.co.vividnext.sodalive.chat.character.repository
|
||||
|
||||
import kr.co.vividnext.sodalive.chat.character.ChatCharacter
|
||||
import kr.co.vividnext.sodalive.chat.character.ChatCharacterBanner
|
||||
import org.springframework.data.domain.Page
|
||||
import org.springframework.data.domain.Pageable
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.data.jpa.repository.Query
|
||||
import org.springframework.data.repository.query.Param
|
||||
import org.springframework.stereotype.Repository
|
||||
|
||||
@Repository
|
||||
interface ChatCharacterBannerRepository : JpaRepository<ChatCharacterBanner, Long> {
|
||||
// 활성화된 배너 목록 조회
|
||||
fun findByIsActiveTrue(pageable: Pageable): Page<ChatCharacterBanner>
|
||||
|
||||
// 특정 캐릭터의 활성화된 배너 목록 조회
|
||||
fun findByChatCharacterAndIsActiveTrue(chatCharacter: ChatCharacter): List<ChatCharacterBanner>
|
||||
|
||||
// 특정 캐릭터 ID의 활성화된 배너 목록 조회
|
||||
fun findByChatCharacter_IdAndIsActiveTrue(characterId: Long): List<ChatCharacterBanner>
|
||||
|
||||
// 이름, 설명, MBTI, 태그로 캐릭터 검색 (배너 포함)
|
||||
@Query(
|
||||
"""
|
||||
SELECT DISTINCT b FROM ChatCharacterBanner b
|
||||
JOIN FETCH b.chatCharacter c
|
||||
LEFT JOIN c.tagMappings tm
|
||||
LEFT JOIN tm.tag t
|
||||
WHERE b.isActive = true AND c.isActive = true AND
|
||||
(
|
||||
LOWER(c.name) LIKE LOWER(CONCAT('%', :searchTerm, '%')) OR
|
||||
LOWER(c.description) LIKE LOWER(CONCAT('%', :searchTerm, '%')) OR
|
||||
(c.mbti IS NOT NULL AND LOWER(c.mbti) LIKE LOWER(CONCAT('%', :searchTerm, '%'))) OR
|
||||
(t.tag IS NOT NULL AND LOWER(t.tag) LIKE LOWER(CONCAT('%', :searchTerm, '%')))
|
||||
)
|
||||
"""
|
||||
)
|
||||
fun searchBannersByCharacterAttributes(
|
||||
@Param("searchTerm") searchTerm: String,
|
||||
pageable: Pageable
|
||||
): Page<ChatCharacterBanner>
|
||||
fun findByActiveTrue(pageable: Pageable): Page<ChatCharacterBanner>
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class ChatCharacterBannerService(
|
|||
* 활성화된 모든 배너 조회
|
||||
*/
|
||||
fun getActiveBanners(pageable: Pageable): Page<ChatCharacterBanner> {
|
||||
return bannerRepository.findByIsActiveTrue(pageable)
|
||||
return bannerRepository.findByActiveTrue(pageable)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,20 +29,6 @@ class ChatCharacterBannerService(
|
|||
.orElseThrow { SodaException("배너를 찾을 수 없습니다: $bannerId") }
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 캐릭터의 활성화된 배너 목록 조회
|
||||
*/
|
||||
fun getActiveBannersByCharacterId(characterId: Long): List<ChatCharacterBanner> {
|
||||
return bannerRepository.findByChatCharacter_IdAndIsActiveTrue(characterId)
|
||||
}
|
||||
|
||||
/**
|
||||
* 이름, 설명, MBTI, 태그로 캐릭터 검색 (배너 포함)
|
||||
*/
|
||||
fun searchBannersByCharacterAttributes(searchTerm: String, pageable: Pageable): Page<ChatCharacterBanner> {
|
||||
return bannerRepository.searchBannersByCharacterAttributes(searchTerm, pageable)
|
||||
}
|
||||
|
||||
/**
|
||||
* 배너 등록
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue