Newer
Older
bremer / src / main / kotlin / dao / ArtistDao.kt
yhornisse on 22 Jul 2023 727 bytes add alias_name
/*
 * Copyright (c) 2023. yo-saito. All Rights Reserved.
 */

package net.piedpiper.bremer.dao

import net.piedpiper.bremer.entity.ArtistEntity
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.ArtistDao")
@Mapper
interface ArtistDao {

    @ResultMap("net.piedpiper.bremer.ArtistEntity")
    @Select("SELECT * FROM artist WHERE name LIKE CONCAT('%', #{nameLike}, '%') LIMIT #{limit}")
    fun findAllByNameLikeLimit(
        @Param("nameLike") nameLike: String,
        @Param("limit") limit: Int
    ): List<ArtistEntity>
}