Search in sources :

Example 1 with ArtistRowMapper

use of com.github.hakko.musiccabinet.dao.jdbc.rowmapper.ArtistRowMapper in project musiccabinet by hakko.

the class JdbcNameSearchDao method getArtists.

@Override
public NameSearchResult<Artist> getArtists(String userQuery, int offset, int limit) {
    String sql = "select ma.id, ma.artist_name_capitalization" + " from library.artist la" + " inner join music.artist ma on la.artist_id = ma.id" + " where la.artist_name_search like ?" + " order by la.hasalbums desc, ma.artist_name" + " offset ? limit ?";
    List<Artist> artists = jdbcTemplate.query(sql, new Object[] { getNameQuery(userQuery), offset, limit }, new ArtistRowMapper());
    return new NameSearchResult<>(artists, offset);
}
Also used : Artist(com.github.hakko.musiccabinet.domain.model.music.Artist) NameSearchResult(com.github.hakko.musiccabinet.domain.model.aggr.NameSearchResult) ArtistRowMapper(com.github.hakko.musiccabinet.dao.jdbc.rowmapper.ArtistRowMapper)

Example 2 with ArtistRowMapper

use of com.github.hakko.musiccabinet.dao.jdbc.rowmapper.ArtistRowMapper in project musiccabinet by hakko.

the class JdbcLibraryBrowserDao method getArtists.

@Override
public List<Artist> getArtists(String tag, int treshold) {
    String topTagsTable = settingsService.getArtistTopTagsTable();
    String sql = "select ma.id, ma.artist_name_capitalization from music.artist ma" + " inner join library.artist la on la.artist_id = ma.id" + " where la.hasalbums and exists (select 1 from" + " " + topTagsTable + " att" + " inner join music.tag t on att.tag_id = t.id" + " where att.artist_id = ma.id and att.tag_count > ? and" + " coalesce(t.corrected_id, t.id) in (select id from music.tag where tag_name = ?))";
    return jdbcTemplate.query(sql, new Object[] { treshold, tag }, new ArtistRowMapper());
}
Also used : TrackWithArtistRowMapper(com.github.hakko.musiccabinet.dao.jdbc.rowmapper.TrackWithArtistRowMapper) ArtistRowMapper(com.github.hakko.musiccabinet.dao.jdbc.rowmapper.ArtistRowMapper)

Aggregations

ArtistRowMapper (com.github.hakko.musiccabinet.dao.jdbc.rowmapper.ArtistRowMapper)2 TrackWithArtistRowMapper (com.github.hakko.musiccabinet.dao.jdbc.rowmapper.TrackWithArtistRowMapper)1 NameSearchResult (com.github.hakko.musiccabinet.domain.model.aggr.NameSearchResult)1 Artist (com.github.hakko.musiccabinet.domain.model.music.Artist)1