刘俊驰 hace 8 meses
padre
commit
a04e2d4c16

+ 2 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/AlbumMusicRelate.java

@@ -7,8 +7,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import java.util.Date;
 
 /**
  * 专辑曲谱关联表
@@ -46,10 +44,10 @@ public class AlbumMusicRelate extends BaseEntity {
 
 	@TableField("album_category_level_id_")
 	@ApiModelProperty(value = "级别")
-	private Long alBumCategoryLevelId;
+	private Long albumCategoryLevelId;
 
 	@TableField("album_category_type_id_")
 	@ApiModelProperty(value = "类型")
-	private Long alBumCategoryTypeId;
+	private Long albumCategoryTypeId;
 
 }

+ 5 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/AlbumCategoryService.java

@@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.yonge.cooleshow.biz.dal.wrapper.AlbumCategoryWrapper;
 import com.yonge.cooleshow.biz.dal.entity.AlbumCategory;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * 机构专辑分类
  * 2024-12-19 16:57:26
@@ -34,4 +37,6 @@ public interface AlbumCategoryService extends IService<AlbumCategory>  {
      *
      */
     Boolean del(Long id);
+
+    Map<Long,AlbumCategory> getMapByIds(List<Long> albumCategoryIds);
 }

+ 19 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/AlbumCategoryServiceImpl.java

@@ -15,6 +15,13 @@ import com.yonge.cooleshow.biz.dal.wrapper.AlbumCategoryWrapper;
 import com.yonge.cooleshow.biz.dal.mapper.AlbumCategoryMapper;
 import com.yonge.cooleshow.biz.dal.service.AlbumCategoryService;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 机构专辑分类
@@ -58,10 +65,18 @@ public class AlbumCategoryServiceImpl extends ServiceImpl<AlbumCategoryMapper, A
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean del(Long id) {
-        return this.lambdaUpdate()
-                .eq(AlbumCategory::getId, id)
-                .set(AlbumCategory::getDelFlag, 1)
-                .update();
+        return this.removeById(id);
+
+    }
+
+    @Override
+    public Map<Long, AlbumCategory> getMapByIds(List<Long> albumCategoryIds) {
+
+        if (CollectionUtils.isEmpty(albumCategoryIds)) {
+            return Collections.emptyMap();
+        }
+        Collection<AlbumCategory> albumCategories = listByIds(albumCategoryIds);
+        return albumCategories.stream().collect(Collectors.toMap(AlbumCategory::getId, albumCategory -> albumCategory));
 
     }
 

+ 2 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/AlbumMusicRelateServiceImpl.java

@@ -68,8 +68,8 @@ public class AlbumMusicRelateServiceImpl extends ServiceImpl<AlbumMusicRelateDao
             albumMusicRelate.setAlbumId(albumId);
             albumMusicRelate.setMusicSheetId(albumMusic.getMusicSheetId());
             albumMusicRelate.setSortNumber(albumMusic.getSortNumber());
-            albumMusicRelate.setAlBumCategoryLevelId(albumMusic.getAlBumCategoryLevelId());
-            albumMusicRelate.setAlBumCategoryTypeId(albumMusic.getAlBumCategoryTypeId());
+            albumMusicRelate.setAlbumCategoryLevelId(albumMusic.getAlBumCategoryLevelId());
+            albumMusicRelate.setAlbumCategoryTypeId(albumMusic.getAlBumCategoryTypeId());
             albumMusicRelate.setCreateTime(new Date());
             albumMusicRelate.setCreateBy(userId);
             return albumMusicRelate;

+ 2 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicAlbumServiceImpl.java

@@ -407,8 +407,8 @@ public class MusicAlbumServiceImpl extends ServiceImpl<MusicAlbumDao,MusicAlbum>
                 .eq(AlbumMusicRelate::getAlbumId,query.getAlbumId())
                 .eq(AlbumMusicRelate::getMusicSheetId,query.getMusicSheetId())
                 .set(AlbumMusicRelate::getSortNumber,query.getSortNumber())
-                .set(AlbumMusicRelate::getAlBumCategoryLevelId,query.getAlBumCategoryLevelId())
-                .set(AlbumMusicRelate::getAlBumCategoryTypeId,query.getAlBumCategoryTypeId())
+                .set(AlbumMusicRelate::getAlbumCategoryLevelId,query.getAlBumCategoryLevelId())
+                .set(AlbumMusicRelate::getAlbumCategoryTypeId,query.getAlBumCategoryTypeId())
                 .update();
 
     }

+ 24 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java

@@ -153,6 +153,9 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
 
     @Autowired
     private SysUserService sysUserService;
+    
+    @Autowired
+    private AlbumCategoryService albumCategoryService;
 
     @Value("${openfeign-client.app-id:1745637981387108354}")
     public Long applicationId;
@@ -371,6 +374,27 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
                 }
             }
         }
+        
+        // 设置专辑
+        List<Long> albumCategoryIds = records.stream().flatMap(o -> Lists.newArrayList(o.getAlbumCategoryTypeId(), o.getAlbumCategoryLevelId()).stream())
+                .filter(Objects::nonNull).distinct().collect(Collectors.toList());
+        Map<Long, AlbumCategory> albumCategoryMap = albumCategoryService.getMapByIds(albumCategoryIds);
+
+        for (MusicSheetVo record : records) {
+            if (record.getAlbumCategoryTypeId() != null) {
+                AlbumCategory albumCategory = albumCategoryMap.get(record.getAlbumCategoryTypeId());
+                if (albumCategory != null) {
+                    record.setAlbumCategoryTypeName(albumCategory.getName());
+                }
+            }
+            if (record.getAlbumCategoryLevelId() != null) {
+                AlbumCategory albumCategory = albumCategoryMap.get(record.getAlbumCategoryLevelId());
+                if (albumCategory != null) {
+                    record.setAlbumCategoryLevelName(albumCategory.getName());
+                }
+            }
+        }
+
 
         return musicSheetVoIPage;
     }

+ 12 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/MusicSheetVo.java

@@ -1,5 +1,6 @@
 package com.yonge.cooleshow.biz.dal.vo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
 import com.yonge.cooleshow.common.enums.YesOrNoEnum;
@@ -57,6 +58,17 @@ public class MusicSheetVo extends MusicSheet {
     @ApiModelProperty("收藏来源")
     private String favoriteProviderType;
 
+    @ApiModelProperty(value = "级别")
+    private Long albumCategoryLevelId;
+
+    @ApiModelProperty(value = "类型")
+    private Long albumCategoryTypeId;
+
+    @ApiModelProperty(value = "级别")
+    private String albumCategoryLevelName;
+
+    @ApiModelProperty(value = "类型")
+    private String albumCategoryTypeName;
 
     @Data
     @EqualsAndHashCode(callSuper = true)

+ 12 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/MusicSheetVoResult.java

@@ -256,6 +256,18 @@ public class MusicSheetVoResult implements Serializable {
     @ApiModelProperty("分类")
     private String categoryName;
 
+    @ApiModelProperty(value = "级别")
+    private Long albumCategoryLevelId;
+
+    @ApiModelProperty(value = "类型")
+    private Long albumCategoryTypeId;
+
+    @ApiModelProperty(value = "级别")
+    private String albumCategoryLevelName;
+
+    @ApiModelProperty(value = "类型")
+    private String albumCategoryTypeName;
+
     public ChargeTypeEnum getChargeType() {
         if (Objects.isNull(this.chargeType) && StringUtils.isNotEmpty(getPaymentType())) {
 

+ 2 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/MusicSheetMapper.xml

@@ -327,6 +327,8 @@
         ,(select group_concat(s.name_) from subject s
             where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames
         ,amr.sort_number_ as albumSortNumber
+        ,amr.album_category_level_id_ as albumCategoryLevelId
+        ,amr.album_category_type_id_ as albumCategoryTypeId
         from music_sheet t
         left join album_music_relate amr on t.id_ = amr.music_sheet_id_
         left join sys_user su on t.create_by_ = su.id_