/* * Copyright (c) 2023. yo-saito. All Rights Reserved. */ package net.piedpiper.bremer.dao import net.piedpiper.bremer.entity.AlbumEntity import net.piedpiper.bremer.entity.AudioPlayHistoryEntity import org.apache.ibatis.annotations.Mapper import org.apache.ibatis.annotations.Param import org.apache.ibatis.annotations.ResultMap import org.apache.ibatis.annotations.Select import org.springframework.stereotype.Repository @Repository("bremer.dao.AlbumDao") @Mapper interface AlbumDao { @ResultMap("net.piedpiper.bremer.AlbumEntity") @Select("""<script> SELECT * FROM album WHERE artist_id IN <foreach item="artistId" collection="artistIds" open="(" separator="," close=")"> #{artistId} </foreach> LIMIT #{limit} </script>""") fun findAllByArtistIdInLimit( @Param("artistIds") artistIds: List<Long>, @Param("limit") limit: Int ): List<AlbumEntity> @ResultMap("net.piedpiper.bremer.AlbumEntity") @Select("SELECT * FROM album WHERE name LIKE CONCAT('%', #{nameLike}, '%') LIMIT #{limit}") fun findAllByNameLikeLimit( @Param("nameLike") nameLike: String, @Param("limit") limit: Int ): List<AlbumEntity> }