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);
}
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());
}
Aggregations