Browse Source

相关曲目

刘俊驰 4 months ago
parent
commit
fc77d41879

+ 8 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/MusicSheetCbsController.java

@@ -12,6 +12,7 @@ import com.yonge.cooleshow.biz.dal.dto.AppMusicSheetVo;
 import com.yonge.cooleshow.biz.dal.dto.search.MusicAlbumSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.MusicSheetRelatedQueryInfo;
 import com.yonge.cooleshow.biz.dal.dto.search.StudentMusicSheetSearch;
+import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
 import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
@@ -153,6 +154,13 @@ public class MusicSheetCbsController extends BaseController {
         query.setUserId(student.getUserId());
         query.setClientType(ClientEnum.STUDENT.name());
 
+        if (query.getMusicSheetId() !=null) {
+            MusicSheet musicSheet = musicSheetService.getById(query.getMusicSheetId());
+            if (musicSheet == null) {
+                return failed("曲目不存在");
+            }
+            query.setMusicSheetType(musicSheet.getMusicSheetType());
+        }
         // 如果是机构学生
         if (student.getTenantId() !=null && student.getTenantId()>0) {
             query.setProviderType(SourceTypeEnum.TENANT);

+ 1 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/MusicSheetWrapper.java

@@ -986,6 +986,7 @@ public class MusicSheetWrapper {
 
         @ApiModelProperty("关键字匹配")
         private String keyword;
+        private Long musicSheetId;
 
         @ApiModelProperty("仅匹配资源名称")
         private String name;

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

@@ -1340,8 +1340,12 @@
         <if test="param.recentFlag != null and param.recentFlag == 1">
             left join sys_music_compare_record msar on t.id_ = msar.music_sheet_id_
         </if>
-        <if test="param.albumId != null">
-            left join tenant_album_music tam on t.id_ = tam.music_sheet_id_ and tam.del_flag_ = 0
+        <if test="param.albumId != null and param.providerType.code == 'TENANT'">
+            left join tenant_album_music tam on t.id_ = tam.music_sheet_id_ and tam.del_flag_ = 0  and tam.tenant_album_id_ = #{param.albumId}
+        </if>
+
+        <if test="param.albumId != null and param.providerType.code == 'PLATFORM'">
+            left join album_music_relate amr on t.id_ = amr.music_sheet_id_ and amr.album_id_ = #{param.albumId}
         </if>
         <if test="param.favoriteFlag != null and param.favoriteFlag == 1">
             left join music_favorite mf on t.id_ = mf.music_sheet_id_ and mf.user_id_ = #{param.userId} and mf.client_type_ = #{param.clientType}
@@ -1418,6 +1422,13 @@
                 </if>
             </if>
 
+            <if test="param.providerType != null and param.providerType.code == 'PLATFORM'">
+                <if test="param.albumId != null">
+                    and amr.id_ is not null
+                </if>
+
+            </if>
+
             <if test="param.providerType != null">
                 and find_in_set(#{param.providerType},t.provider_type_)
             </if>