yonge 5 дней назад
Родитель
Сommit
22d61692f0

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

@@ -113,6 +113,13 @@ public class TenantAlbumMusicServiceImpl extends ServiceImpl<TenantAlbumMusicMap
     public IPage<TenantAlbumMusicWrapper.StudentTenantAlbumMusic> selectPage(IPage<TenantAlbumMusicWrapper.StudentTenantAlbumMusic> page,
                                                                              TenantAlbumMusicWrapper.StudentTenantAlbumMusicQuery query) {
         List<TenantAlbumMusicWrapper.StudentTenantAlbumMusic> musicSheets = new ArrayList<>();
+      //查询购买了哪些专辑权限
+    	if(query.getClientType() == ClientEnum.TEACHER) {
+    		// 判断是否还在生效中
+            List<UserTenantAlbumRecord> albumRecordList = userTenantAlbumRecordService.getUseAlbumByUserId(query.getUserId(), query.getClientType());
+            List<Long> tenantAlbumIdList = albumRecordList.stream().map(UserTenantAlbumRecord :: getTenantAlbumId).collect(Collectors.toList());
+            query.setTenantAlbumIdList(tenantAlbumIdList);
+    	}
         if (query.getSubjectType() != SubjectTypeEnum.COURSEWARE) {
 
             musicSheets = tenantAlbumMusicMapper.selectPage(page, query);

+ 6 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/TenantAlbumMusicMapper.xml

@@ -55,6 +55,12 @@
                     #{item}
                 </foreach>
             </if>
+            <if test="param.tenantAlbumIdList != null and param.tenantAlbumIdList.size() != 0">
+                and t.tenant_album_id_ in
+                <foreach collection="param.tenantAlbumIdList" item="item" index="index" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
 
             <if test="param.keyword != null and param.keyword != ''">
                 and m.music_sheet_name_ LIKE CONCAT('%',#{param.keyword},'%')