Pārlūkot izejas kodu

去掉曲目分类

zouxuan 7 mēneši atpakaļ
vecāks
revīzija
a766ebcdef

+ 14 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicScoreAccompanimentServiceImpl.java

@@ -245,8 +245,21 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Strin
 		Map<String, Object> params = new HashMap<>();
 		MapUtil.populateMap(params, queryInfo);
         List<SysMusicScoreAccompaniment> sysMusicScoreAccompaniments = sysMusicScoreAccompanimentDao.queryAccPage(params);
+		Map<Integer, SysMusicScoreCategories> categoriesMap = new HashMap<>();
+		if(CollectionUtils.isNotEmpty(sysMusicScoreAccompaniments)){
+			List<Integer> categoryIds = sysMusicScoreAccompaniments.stream()
+					.map(SysMusicScoreAccompaniment::getCategoriesId).distinct().collect(Collectors.toList());
+			List<SysMusicScoreCategories> categories = cbsMusicScoreCategoriesService.queryByIds(categoryIds.stream()
+					.map(String::valueOf).collect(Collectors.joining(",")));
+			categoriesMap = categories.stream().collect(Collectors.toMap(SysMusicScoreCategories::getId, Function.identity()));
+		}
         for (SysMusicScoreAccompaniment sysMusicScoreAccompaniment : sysMusicScoreAccompaniments) {
-            if (sysMusicScoreAccompaniment.getIsOpenMetronome() ==null || sysMusicScoreAccompaniment.getIsOpenMetronome()) {
+			SysMusicScoreCategories categories = categoriesMap.get(sysMusicScoreAccompaniment.getCategoriesId());
+			if(categories != null){
+				sysMusicScoreAccompaniment.setCategoriesName(categories.getName());
+				sysMusicScoreAccompaniment.setParentCategoriesId(categories.getParentId());
+			}
+			if (sysMusicScoreAccompaniment.getIsOpenMetronome() ==null || sysMusicScoreAccompaniment.getIsOpenMetronome()) {
                 if (StringUtils.isNotBlank(sysMusicScoreAccompaniment.getUrl())) {
                     sysMusicScoreAccompaniment.setMetronomeUrl(sysMusicScoreAccompaniment.getUrl());
                 }