刘俊驰 пре 3 месеци
родитељ
комит
4d293b8285

+ 12 - 1
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/MusicSheetCbsController.java

@@ -79,7 +79,8 @@ public class MusicSheetCbsController extends BaseController {
     })
     @GetMapping("/cbsDetail/{id}")
     public R<MusicSheetVo.MusicSheetDetail> cbsDetail(@PathVariable("id") Long id,
-                                                      @RequestParam(required = false) String tenantAlbumId) {
+                                                      @RequestParam(required = false) String tenantAlbumId,
+                                                      @RequestParam(required = false) String providerType) {
 
         SysUser sysUser = sysUserService.getUser();
         // 曲目信息
@@ -93,6 +94,16 @@ public class MusicSheetCbsController extends BaseController {
         CbsMusicSheetWrapper.MusicSheet cbsMusicSheet = musicSheetService.cbsDetail(musicSheet.getCbsMusicSheetId());
         cbsMusicSheet.setBizId(id);
 
+
+        // 设置查询机构 还是平台数据
+        if (StringUtils.isBlank(tenantAlbumId) && StringUtils.isNotBlank(providerType)) {
+            if (SourceTypeEnum.PLATFORM.name().equals(providerType)) {
+                tenantAlbumId = null;
+            } else {
+                tenantAlbumId = StringUtils.isBlank(tenantAlbumId) ? null : "1";
+            }
+        }
+
         MusicSheetVo.MusicSheetDetail musicSheetDetail = JSON.parseObject(JSON.toJSONString(cbsMusicSheet), MusicSheetVo.MusicSheetDetail.class);
         MusicSheetDetailVo detail = musicSheetService.detail(id.toString(), sysUser, ClientEnum.TEACHER, tenantAlbumId);
         if (detail != null) {

+ 13 - 1
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/MusicSheetController.java

@@ -69,7 +69,19 @@ public class MusicSheetController extends BaseController {
     @GetMapping("/detail/{id}")
     @ApiOperation(value = "详情", notes = "传入musicTag")
     public HttpResponseResult<MusicSheetDetailVo> detail(@ApiParam(value = "曲谱编号", required = true) @PathVariable("id") String id,
-                                                         @RequestParam(required = false) String tenantAlbumId) {
+                                                         @RequestParam(required = false) String tenantAlbumId,
+                                                         @RequestParam(required = false) String providerType) {
+
+
+        // 设置查询机构 还是平台数据
+        if (StringUtils.isBlank(tenantAlbumId) && StringUtils.isNotBlank(providerType)) {
+            if (SourceTypeEnum.PLATFORM.name().equals(providerType)) {
+                tenantAlbumId = null;
+            } else {
+                tenantAlbumId = StringUtils.isBlank(tenantAlbumId) ? null : "1";
+            }
+        }
+
         SysUser sysUser = sysUserService.getUser();
         MusicSheetDetailVo detail = musicSheetService.detail(id, sysUser, ClientEnum.TEACHER,tenantAlbumId);
 

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

@@ -1092,6 +1092,24 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
         List<MusicSheetVo> records = baseMapper.selectFavoriteMusicPage(page, query, clientType);
 
         if (CollectionUtils.isNotEmpty(records)) {
+
+            // 设置收藏来源
+            // 曲目ID集合
+
+            /*
+曲目1:既在机构也在平台,只收藏了平台,则进入是平台,
+曲目1:既在机构也在平台,只收藏了机构,则进入是机构
+曲目1:既在机构也在平台,又收藏了机构也收藏了平台,则进入是平台
+曲目1:只在机构,收藏在机构,则进入是机构
+曲目1:只在平台,收藏在平台,则进入是平台
+             */
+            for (MusicSheetVo record : records) {
+                if (record.getFavoriteProviderType().contains("PLATFORM")) {
+                    record.setFavoriteProviderType("PLATFORM");
+                }
+            }
+
+
             this.initMusicSheetVos(records);
 
             // 更新曲目专辑数量

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

@@ -55,6 +55,8 @@ public class MusicSheetVo extends MusicSheet {
     @ApiModelProperty("所属人信息")
     private CbsMusicSheetWrapper.MusicSheetExtend musicSheetExtend;
 
+    @ApiModelProperty("收藏来源")
+    private String favoriteProviderType;
 
 
     @Data

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

@@ -594,6 +594,7 @@
         select distinct <include refid="Base_Column_List"/>
         ,su.username_ as addName
         ,su.avatar_ as addUserAvatar
+        ,group_concat(mf.provider_type_) as favoriteProviderType
         ,(select group_concat(mt.name_) from music_tag mt
         where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0  and mt.state_ = 1) as musicTagNames
         ,(select group_concat(s.name_) from subject s
@@ -602,9 +603,6 @@
         from music_sheet t
         left join sys_user su on t.create_by_ = su.id_
         left join music_favorite mf on t.id_ = mf.music_sheet_id_
-        <if test="param.auditStatus != null">
-            left join music_sheet_auth_record msar ON msar.music_sheet_id_ = t.id_
-        </if>
         <where>
 
             mf.client_type_ = #{clientType}
@@ -629,9 +627,7 @@
                 and mf.user_id_ = #{param.studentId}
             </if>
         </where>
-        <if test="param.auditStatus != null">
-            group by msar.music_sheet_id_
-        </if>
+        group by t.id_
         order by mf.id_ desc
     </select>