瀏覽代碼

查询过滤声部

刘俊驰 1 年之前
父節點
當前提交
d17fba3e99

+ 5 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/MusicSheetController.java

@@ -432,6 +432,11 @@ public class MusicSheetController extends BaseController {
             throw new BizException("用户信息获取失败");
         }
         queryInfo.setUserId(sysUser.getId());
+        Student student = studentService.getById(sysUser.getId());
+        if (student == null) {
+            throw new BizException("用户信息获取失败");
+        }
+        queryInfo.setSubjectId(Integer.parseInt(student.getSubjectId()));
         return succeed(musicSheetService.searchTenant(queryInfo));
     }
 

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

@@ -1932,6 +1932,10 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
         }
 
         List<TenantAlbumMusic> list = tenantAlbumMusicMapper.getByAlbumAndEnable(albumIds);
+        // 过滤出曲目
+        List<SubjectTypeEnum> enumList = Lists.newArrayList(SubjectTypeEnum.MUSIC, SubjectTypeEnum.SUBJECT, SubjectTypeEnum.ENSEMBLE);
+        list = list.stream().filter(tenantAlbumMusic -> enumList.contains(tenantAlbumMusic.getSubjectType())).collect(Collectors.toList());
+
         // 根据曲目ID分组
         Map<Long, List<Long>> map = list.stream()
             .collect(Collectors.groupingBy(TenantAlbumMusic::getMusicSheetId, Collectors.mapping(TenantAlbumMusic::getTenantAlbumId, Collectors.toList())));

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

@@ -833,6 +833,7 @@
                         #{item}
                     </foreach>
                     and tam.del_flag_=0
+                    and tam.subject_type_ in ('ENSEMBLE', 'MUSIC', 'SUBJECT')
                 </if>
                 <if test="param.providerType != null">
                     and t.provider_type_ = #{param.providerType}