|
@@ -360,16 +360,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
if (CollectionUtils.isNotEmpty(records)) {
|
|
if (CollectionUtils.isNotEmpty(records)) {
|
|
|
|
|
|
// 统计单曲归属专辑数
|
|
// 统计单曲归属专辑数
|
|
- List<Long> musicIds = records.stream()
|
|
|
|
- .map(MusicSheet::getId).distinct().collect(Collectors.toList());
|
|
|
|
-
|
|
|
|
- Map<Long, Integer> collect = getBaseMapper().selectMusicAlbumStatInfo(musicIds).stream()
|
|
|
|
- .collect(Collectors.toMap(StatGroupWrapper::getId, StatGroupWrapper::getTotal, (o, n) -> n));
|
|
|
|
-
|
|
|
|
- for (MusicSheetVo item : records) {
|
|
|
|
-
|
|
|
|
- item.setAlbumNums(collect.getOrDefault(item.getId(), 0));
|
|
|
|
- }
|
|
|
|
|
|
+ updateMusicAlbumNumInfo(records);
|
|
}
|
|
}
|
|
|
|
|
|
/*if(query.getMyself() != null && query.getMyself() == false){//首页
|
|
/*if(query.getMyself() != null && query.getMyself() == false){//首页
|
|
@@ -396,6 +387,26 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 更新曲目专辑数
|
|
|
|
+ * @param records List<MusicSheetVo>
|
|
|
|
+ * @return List<MusicSheetVo>
|
|
|
|
+ */
|
|
|
|
+ public List<MusicSheetVo> updateMusicAlbumNumInfo(List<MusicSheetVo> records) {
|
|
|
|
+ List<Long> musicIds = records.stream()
|
|
|
|
+ .map(MusicSheet::getId).distinct().collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ Map<Long, Integer> collect = getBaseMapper().selectMusicAlbumStatInfo(musicIds).stream()
|
|
|
|
+ .collect(Collectors.toMap(StatGroupWrapper::getId, StatGroupWrapper::getTotal, (o, n) -> n));
|
|
|
|
+
|
|
|
|
+ for (MusicSheetVo item : records) {
|
|
|
|
+
|
|
|
|
+ item.setAlbumNums(collect.getOrDefault(item.getId(), 0));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return records;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public boolean setFavorite(Long userId, Long musicSheetId, ClientEnum clientType) {
|
|
public boolean setFavorite(Long userId, Long musicSheetId, ClientEnum clientType) {
|